javac bug: defender method processing

Brian Goetz brian.goetz at oracle.com
Wed Oct 27 14:43:42 PDT 2010


I created this file:

src/Impl.java (no package)

class Impl {
     public static int one() { return 1 };
}

and this test file:

src/junit/SimpleDefenderTest.java:

package junit;

import junit.framework.TestCase;

public class SimpleDefenderTest extends TestCase {
     private static interface A {
         public extension int get() default Impl.one;
     }

     private static class C implements A {
     }

     public void testSimpleWeave() {
         C c = new C();
         assertEquals(1, c.get());
     }
}


It failed to compile, with this error:

     [javac] src/junit/SimpleDefenderTest.java:7: cannot find symbol
     [javac]         public extension int get() default Impl.one;
     [javac]                              ^
     [javac]   symbol:   variable Impl
     [javac]   location: interface A
     [javac] 1 error


The problem seems to be either that Impl was in the empty package, or maybe 
that it was just in another package.  I moved it to the same package and it 
worked.





More information about the lambda-dev mailing list