-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
5.0
-
generic
-
solaris_8
Matthias Zenger wrote:
> yesterday I was playing a little bit with your javac pre-release
> that includes wildcards. Everything seems to work fine as long as
> there are no inner classes involved. Here's a small example
> that basically yields a "method not found" exception at runtime even
> though it compiles without complaints:
>
> class A {
> void a() {}
> }
> class B extends A {
> void b() {}
> }
> class Bug<T> {
> T elem;
> class Inner {
> void put(T e) {
> elem = e;
> }
> }
> public static void main(String[] args) {
> Bug<B> b = new Bug<B>();
> Bug<? extends A> a = b;
> a.new Inner().put(new A()); // this should not be possible
> b.elem.b(); // this yields a ClassCastException
> }
> }
> yesterday I was playing a little bit with your javac pre-release
> that includes wildcards. Everything seems to work fine as long as
> there are no inner classes involved. Here's a small example
> that basically yields a "method not found" exception at runtime even
> though it compiles without complaints:
>
> class A {
> void a() {}
> }
> class B extends A {
> void b() {}
> }
> class Bug<T> {
> T elem;
> class Inner {
> void put(T e) {
> elem = e;
> }
> }
> public static void main(String[] args) {
> Bug<B> b = new Bug<B>();
> Bug<? extends A> a = b;
> a.new Inner().put(new A()); // this should not be possible
> b.elem.b(); // this yields a ClassCastException
> }
> }