Summary: | Type mismatch: cannot convert from List<Class> to List<Class<?>> | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | kite <yipeng97> |
Component: | Core | Assignee: | Kent Johnson <kent_johnson> |
Status: | VERIFIED NOT_ECLIPSE | QA Contact: | |
Severity: | critical | ||
Priority: | P3 | CC: | srikanth_sankaran |
Version: | 3.5 | ||
Target Milestone: | 3.6 M1 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
kite
2009-07-03 23:18:20 EDT
Tried this case with javac : import java.util.*; class X { void test(List<Class> list, List<Class<?>> list2) { list = list2; list2 = list; } } X.java:6: incompatible types list = list2; ^ required: java.util.List<java.lang.Class> found: java.util.List<java.lang.Class<?>> X.java:7: incompatible types list2 = list; ^ required: java.util.List<java.lang.Class<?>> found: java.util.List<java.lang.Class> 2 errors So why should the asList call work ? Sorry I missed this the first time around. In 1.5, Class.getInterfaces() was defined as : public native Class[] getInterfaces(); In 6.0, it was defined as : public native Class<?>[] getInterfaces(); So ensure you're using a JDK 6 VM if you expect this to work : List<Class<?>> defs = Arrays.asList(Object.class.getInterfaces()); Verified for 3.6M1 |