[Scons-users] IndexError in Java parser with anonymous classes

Bill Deegan bill at baddogconsulting.com
Wed Oct 7 11:50:34 EDT 2015


Will,

What version of SCons are you running?

-Bill

On Wed, Oct 7, 2015 at 11:10 AM, William Keith <wak at kaon.co.uk> wrote:

> Hello,
>
> I am trying to use SCons to build the following Java file:
>
> class MyApp
> {
>     private static class MyInnerClass
>     {
>         private void blah()
>         {
>             new Something(new SomethingElse()
>                 {
>                 });
>         }
>     }
>
>     private static void doStuff()
>     {
>         new Foo<Bar<Baz>>() {
>                 @Override
>                 public void boz()
>                 {
>                 }
>             };
>     }
>
>     public static void main(String[] args)
>     {
>         new Whatsit()
>             {
>             };
>     }
> }
>
> My SConstruct is as follows:
>
> app_classes = Java(target='build/classes', source='src',
> JAVAVERSION='1.7')
> jar_sources = app_classes
> Jar(target='build/target.jar', source=jar_sources)
>
> Running scons with the above results in an IndexError with the following
> stack trace:
>
> scons: Reading SConscript files ...
> IndexError: list index out of range:
>   File "/home/projects/scons_java_test/SConstruct", line 7:
>     app_classes = Java(target='build/classes', source='src',
> JAVAVERSION='1.7')
>   File "/usr/lib/scons/SCons/Script/SConscript.py", line 609:
>     return method(*args, **kw)
>   File "/usr/lib/scons/SCons/Environment.py", line 224:
>     return self.method(*nargs, **kwargs)
>   File "/usr/lib/scons/SCons/Tool/javac.py", line 195:
>     result.extend(b(t, s, *args, **kw))
>   File "/usr/lib/scons/SCons/Environment.py", line 260:
>     return MethodWrapper.__call__(self, target, source, *args, **kw)
>   File "/usr/lib/scons/SCons/Environment.py", line 224:
>     return self.method(*nargs, **kwargs)
>   File "/usr/lib/scons/SCons/Builder.py", line 633:
>     return self._execute(env, target, source, OverrideWarner(kw), ekw)
>   File "/usr/lib/scons/SCons/Builder.py", line 554:
>     tlist, slist = self._create_nodes(env, target, source)
>   File "/usr/lib/scons/SCons/Builder.py", line 518:
>     target, source = self.emitter(target=tlist, source=slist, env=env)
>   File "/usr/lib/scons/SCons/Tool/javac.py", line 97:
>     pkg_dir, classes = parse_java_file(f.rfile().get_abspath(), version)
>   File "/usr/lib/scons/SCons/Tool/JavaCommon.py", line 286:
>     return parse_java(open(fn, 'r').read(), version)
>   File "/usr/lib/scons/SCons/Tool/JavaCommon.py", line 300:
>     currstate = currstate.parseToken(token)
>   File "/usr/lib/scons/SCons/Tool/JavaCommon.py", line 221:
>     self.outer_state.addAnonClass()
>   File "/usr/lib/scons/SCons/Tool/JavaCommon.py", line 178:
>     self.__getAnonStack()[-1] = self.__getAnonStack()[-1] + 1
>
> Note that I have attempted to pare the example down to just what is
> essential to reproduce this issue. Apart from some missing symbols, it
> should be valid Java. The original (un-pared-down) version compiles cleanly
> with javac but produces the same exception in SCons' Java parser.
>
> I am fairly sure this is a new bug. Can someone please advise?
>
> Thanks,
>
> Will
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20151007/95fb22dd/attachment.html>


More information about the Scons-users mailing list