Community
Participate
Working Groups
HEAD, followup to bug 131935. This CU compiles with a (correct) error in javac 1.5 and 1.6, but Eclipse accepts it without error: import java.lang.ref.*; class Soft extends SoftReference<String> { Soft() { super(null); } } class Bug { void m(Reference<? extends Number> remove) { Soft soft= (Soft) remove; } } javac 1.6.0-beta2 C:\e\w\runtime-workspace\zz1.5\src\xy\Bug.java:11: inconvertible types found : java.lang.ref.Reference<capture#939 of ? extends java.lang.Number> required: xy.Soft Soft soft= (Soft) remove; ^ 1 error
Strictly speaking our behavior is legite, since Reference<capture-of ? extends Number> is assimilated to Reference<U> (U being a fresh new type variable), and it is not provably distinct by the rules of JLS 4.5.
Added GenericTypeTest#test0959.
*** This bug has been marked as a duplicate of 120088 ***
GenericTypeTest#test0959 got enabled.
Verified for 3.4 M3 using build I20071029-0010.