Community
Participate
Working Groups
Eclipse3.1 M7 flagged this as a warning. Sun's javac warns "Bug.java uses unchecked or unsafe operations." But Eclipse3.1 RC1 falsely gives a compile error that says "Cannot cast from Bug.Implements to Comparable<Row>", even though all my J2SE 5.0 options are set to 'warning' in my Eclipse preferences. Remove the seemingly insignificant 'final' keyword below, and the false compiler error suddenly changes to a warning. --------------------------- Bug.java ---------------------- class Bug<Row> { static interface Interface extends Comparable<String>{} static final class Implements implements Interface{ public int compareTo(String o) {return 0;} } void method (){ ((Comparable<Row>)new Implements()).toString(); //COMPILER FALSE ERROR. } }
Reproduced. Indeed our check is too strict. Added GenericTypeTest#test899. Problem comes from the class being final, which triggered an extra check, over constraining. Fixed in 3.2 stream.
Fixed
Actually, GenericTypeTest added is: test900. Also tuned test661 corresponding to bug 95066.
Verified for 3.2 M5 using build I20060215-0010
Verified that it has been backported to R3_2_maintenance stream.
Sorry, in previous comment, you should obviously read 'R3_1_maintenance' instead...