javac bug: inheritance of defenders
Brian Goetz
brian.goetz at oracle.com
Wed Oct 27 15:02:34 PDT 2010
The following class fails to compile:
public class SimpleDefenderTest extends TestCase {
private static interface A {
public extension int get() default Implementations.one;
}
private static interface B extends A { }
private static class C implements A { }
private static class D extends C { }
private static class E implements B { }
public void testSimpleWeave() {
C c = new C();
assertEquals(1, c.get());
}
public void testExtendWovenClass() {
D d = new D();
assertEquals(1, d.get());
}
public void testAnonymousWeave() {
assertEquals(1, new A() { }.get());
}
public void testImplementSubclassOfExtended() {
E e = new E();
assertEquals(1, e.get());
}
}
test-compile:
[javac] Compiling 1 source file to
/home/brian/work/mangler/trunk/defender/build/test-classes
[javac]
/home/brian/work/mangler/trunk/defender/test/src/junit/SimpleDefenderTest.java:34:
cannot find symbol
[javac] assertEquals(1, e.get());
[javac] ^
[javac] symbol: method get()
[javac] location: class E
[javac] 1 error
The implementation of the one() method is straightforward:
public class Implementations {
public static int one(Object receiver) {
return 1;
}
public static int two(Object receiver) {
return 2;
}
}
It would appear that E is not believed to have member get(), which is
inherited from B, which is inherited from A.
More information about the lambda-dev
mailing list