Community
Participate
Working Groups
The following code doesn't compile: class Y<E> { void foo(E e) { } } class X { void method(Y<? super Object[]> y) { y.foo(new Object[]{}); } } We report: ---------- 1. ERROR in d:\tests_sources\X.java (at line 7) y.foo(new Object[]{}); ^^^ The method foo(capture-of ? super Object[]) in the type Y<capture-of ? super Object[]> is not applicable for the arguments (Object[]) ---------- 1 problem (1 error)
Indeed this should be allowed. Note that javac also rejects it, likely the same bug we do have. Tuned ArrayBinding compatibility check against captures to check lower bounds. Added GenericTypeTest#test803.
Test is actually #test804
Matching bug for javac is http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6268476
fixed
Verified in I20050921-0010 for 3.2M2
Verified for 3.1.1 using M20050923-1430.