Compiler binds base class incorrectly (shortcoming of base class circularity spec)
Neal Gafter
neal at gafter.com
Tue Feb 8 00:57:11 PST 2011
Javac (any version) compiles the following code without error, but when Main
is run it prints "X.Q" instead of "A<T>.X.Q" as required by the language
specification. I think this is really a shortcoming of the specification
for circular class declarations, but demonstrating my point is easier if I
just start by reporting it as a compiler bug.
*class A<T> {
static class X {
static class Q {
public static void main() {
System.out.println("A<T>.X.Q");
}
}
}
}
class B extends A<B.Y.Q> {
static class Y extends X { } // X here is inherited from A
}
class X {
static class Q {
public static void main() {
System.out.println("X.Q");
}
}
}
class Main {
public static void main(String[] args) {
B.Y.Q.main();
}
}
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20110208/87358ca4/attachment.html
More information about the compiler-dev
mailing list