Community
Participate
Working Groups
Build ID: I20090611-1540 Steps To Reproduce: 1.Create a java source file, switch JRE to IBM JDK 5.0, Type this statement, List<Class<?>> defs = Arrays.asList(Object.class.getInterfaces()); 2.JDT show error info for this statement,can not produce class file. 3.Switch JRE to Sun JDK, it's ok. More information:
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