Summary: | [1.5][compiler] Illegal generic conversion allowed. | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Brian Miller <bmiller> |
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | markus.kell.r |
Version: | 3.2 | ||
Target Milestone: | 3.2 M6 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Brian Miller
2006-03-15 09:50:07 EST
Simpler example: import java.lang.ref.*; class Soft extends SoftReference<String> { Soft() { super(null); } } class Bug { void m(Reference<? extends String> remove) { Soft soft= (Soft) remove; } } On the first example, javac 1.6 (b71) doesn't complain. We emit a type safety warning, but javac doesn't. ---------- 1. WARNING in d:\tests_sources\X.java (at line 24) cache.remove(((Soft)trash.remove()).key); ^^^^^^^^^^^^^^^^^^^^^^ Type safety: The cast from Reference<capture-of ? extends String> to X.Soft is actually checking against the erased type X.Soft ---------- For the second example, Eclipse and javac 1.6 reports an error. Could this be a bug in javac that has been fixed in 1.6 branch? Tuned the code to not report unchecked cast warning. Added GenericTypeTest#test0958 Note: no error is expected here, and no warning either. Fixed Verified for 3.2 M6 using build I20060329-0010. |