Community
Participate
Working Groups
I20081209-0100 import java.util.List; public class X { boolean foo() { return null instanceof List<Object>; } } This reports: "Cannot perform instanceof check against parameterized type List<Object>. Use instead its raw form List since generic type information will be erased at runtime" It should not suggests to us a raw type since it will trigger a warning (see bug 252120). It should suggests to use List<?> instead.
True, but note that quickfix caused a compile error to be raised, which is bad when attempting to fix a warning... they should het a bug opened as well.
(In reply to comment #1) > True, but note that quickfix caused a compile error to be raised, which is bad > when attempting to fix a warning... they should het a bug opened as well. Entered bug 258059 against JDT/UI
Note also, that our message wasn't good for instanceof T (type param). e.g. import java.util.*; public class X { <T extends List<Object>> boolean foo2() { return null instanceof T; } } --> Cannot perform instanceof check against type parameter T. Use instead its erasure List<E> since generic type information will be erased at runtime Will fix it as well.
Added GenericTypeTest#test1426
Created attachment 119898 [details] Proposed patch
Created attachment 119906 [details] Better patch
Released for 3.5M4
Fixed
Verified for 3.5M4 using I20081211-0100