Community
Participate
Working Groups
The following code will compile in Eclipse(3.2.2) but not with the latest Sun JDK(build 1.6.0_01-b06) I can't tell which is right, but if the Sun JDK follows the spec exactly then the Eclipse JDT compiler contains a bug, otherwise it's probably a Sun bug. Hoping someone can clear the matter up. JDT version: Version: 3.2.2.r322_v20070104-R4CR0Znkvtfjv9- Build id: M20070212-133 Output: Roo! 1.0 2.0 class [Ljava.lang.Object; Expected: The code should not compile ( if we assume Sun's JDK is correct ) The error given by the Sun compiler is: ---------------------------------------------------- test.java:8: cannot select from a type variable System.out.println(T[].class); ^ 1 error ---------------------------------------------------- TEST CODE: ---------------------------------------------------- class test { public static <T> void myFunc(T[] test) { for (T t : test) System.out.println(t); System.out.println(T[].class); } public static void main(String []args) { System.out.println("Roo!"); Float f[] = new Float[] { 1.0f, 2.0f }; myFunc(f); } }
this is a dup of bug 181270, which got addressed in 3.3M7. *** This bug has been marked as a duplicate of bug 181270 ***