Community
Participate
Working Groups
If you check out the jaxb 2.0 cvs source tree, there are tons of compilation errors related to Generics. These errors don't occur if compiled using Ant, Netbeans or IntelliJ. Details: If I set up a project in Netbeans (4.1.x) or IntelliJ (5.0.x) or just build it directly via Ant (1.6.5), the source code compiles just fine. But if I set up a project in Eclipse (3.1.2 or 3.2M4), a lot of source codes with Java 5 generics constructs are marked as errors by the IDE! (Example: ElementInfoImpl.java under package com.sun.xml.bind.v2.model.impl) This seems to indicate that as jar as Java generics goes Eclipse is not quite up to the task yet. I am not sure if they have anonymous cvs access, but if you subscribe to www.dev.java.net (which is free), you can check out the jaxb 2.0 cvs source tree and see the IDE differences (simply by importing the existing project config files set up for various IDE's including Eclipse, Netbeans and IntelliJ): cvs -d:pesrver:yourid@cvs.dev.java.net:/cvs co -d jaxb-ri jaxb2-sources/jaxb-ri
Are you sure that your compiler settings are set to 1.5?
Yes, I am sure. The JDK Compilance level is all set to 5.0. As mentioned earlier, you can easily check out the cvs tree from jaxb2.0 and see all the generics problems in Eclipse. Note not all generics classes have problems, but significantly so in many classes in jaxb 2.0.
Also, I tried it in Eclipse 3.1.1, 3.1.2 and 3.2M4. All appears to have the same problems.
I will request access to this source code.
Further investigation (by fixing the build path) seems to reduce the number of errors to two specific errors related to Generics using Eclipse 3.2M4: Error The return type is incompatible with RuntimeClassInfo.getLocatorField() RuntimeClassInfoImpl.java JAXB 2.x/runtime/src/com/sun/xml/bind/v2/model/impl line 194 Error The return type is incompatible with RuntimeLeafInfo.getTransducer() RuntimeEnumLeafInfoImpl.java JAXB 2.x/runtime/src/com/sun/xml/bind/v2/model/impl line 31
Created attachment 34025 [details] Test case Compile this test case using Eclipse compiler.
javac reports two warnings: X.java:7: warning: bar() in X implements <V>bar() in I; return type requires unchecked conversion found : C<T> required: C<V> public C<T> bar() { ^ X.java:3: warning: foo() in X implements <T>foo() in I; return type requires unchecked conversion found : A<?,J> required: A<T,J> public A<?,J> foo() { ^ 2 warnings We report: ---------- 1. ERROR in d:\tests_sources\X.java (at line 3) public A<?,J> foo() { ^^^^^ The return type is incompatible with I.foo() ---------- 2. ERROR in d:\tests_sources\X.java (at line 7) public C<T> bar() { ^^^^^ The return type is incompatible with I.bar() ---------- 2 problems (2 errors) This should correspond to the two failures reported in comment 5. I have many more errors for unresolved types, but I won't focus on them since they might be related to wrong build paths.
*** Bug 106880 has been marked as a duplicate of this bug. ***
Fixed return type conversion warning cases. Added MethodVerify test81. Please let us know if you have other 5.0 compiler problems with your project.
*** Bug 105339 has been marked as a duplicate of this bug. ***
Verified for 3.2 M6 using warm-up build I20060327-0010.