The following code compiles even if it shouldn't: 1) class Foo<X> { X x; } class Test { void m(int i) { } void test(Foo<? extends Integer> fi) { m(fi.x); } } 2) class Test<T extends Integer> { void i(int arg) {} void foo(T arg) { i(arg); } } 3) class CaptureTest { <T> List<T> singleton(T arg) { return null; } void test(List<? extends Number> l) { List<Number> ln = singleton(l.get(0)); } }
|