Nested generics don't compile in 1.7.0_15, but do in 1.6.0_27.
Zhong Yu
zhong.j.yu at gmail.com
Tue Mar 12 08:07:49 PDT 2013
> Maurizio Cimadamore
> class Foo<X> { }
> class FooString extends Foo<String> { }
> class SubFoo<X> extends FooString { }
This code compiles
Class<? extends SubFoo> c1 = SubFoo.class;
Class<? extends FooString> c2 = c1;
Class<? extends Foo<String>> c3 = c2;
but then this fails
c3 = c1;
which is a little inconsistent.
BTW, typos in JLS7 section 4.10.2
http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.10.2
there are 3 mentionings of C<T1,...,Tn>, but the 1st and the 3rd
should actually be C<F1,...,Fn>.
Zhong Yu
More information about the compiler-dev
mailing list