Community
Participate
Working Groups
Cheetah03 The following program should issue 2 errors: public class X { public static void main(String[] args) { XList<?> lx = new XList<X>(); X x = lx.get(); lx.add(null); lx.add(new X()); // cannot apply add(?) lx.slot = new X(); // cannot assign to ? } } class XList<E extends X> { E slot; void add(E e) {} E get() { return null; } }
Added regression test: GenericTypeTest#test145
We must disallow usage of methods with wildcard parameter or assigning to field which type is a wildcard. We still tolerate using parameterized wildcard type: foo(X<?>). Fixed