Bug 125956 - [1.5][compiler] Failed to compile Jaxb 2.0
Summary: [1.5][compiler] Failed to compile Jaxb 2.0
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 105339 106880 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-01-31 19:14 EST by Hanson Char CLA
Modified: 2006-03-27 10:25 EST (History)
2 users (show)

See Also:


Attachments
Test case (696 bytes, application/octet-stream)
2006-02-02 12:01 EST, Olivier Thomann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hanson Char CLA 2006-01-31 19:14:32 EST
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
Comment 1 Olivier Thomann CLA 2006-01-31 21:13:23 EST
Are you sure that your compiler settings are set to 1.5?
Comment 2 Hanson Char CLA 2006-01-31 22:28:24 EST
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.
Comment 3 Hanson Char CLA 2006-01-31 22:29:45 EST
Also, I tried it in Eclipse 3.1.1, 3.1.2 and 3.2M4.  All appears to have the same problems.
Comment 4 Olivier Thomann CLA 2006-01-31 23:59:17 EST
I will request access to this source code.
Comment 5 Hanson Char CLA 2006-02-01 01:32:07 EST
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
Comment 6 Olivier Thomann CLA 2006-02-02 12:01:49 EST
Created attachment 34025 [details]
Test case

Compile this test case using Eclipse compiler.
Comment 7 Olivier Thomann CLA 2006-02-02 12:03:26 EST
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.
Comment 8 Kent Johnson CLA 2006-02-23 11:23:40 EST
*** Bug 106880 has been marked as a duplicate of this bug. ***
Comment 9 Kent Johnson CLA 2006-02-23 13:11:18 EST
Fixed return type conversion warning cases.

Added MethodVerify test81.

Please let us know if you have other 5.0 compiler problems with your project.
Comment 10 Kent Johnson CLA 2006-02-24 13:15:01 EST
*** Bug 105339 has been marked as a duplicate of this bug. ***
Comment 11 Frederic Fusier CLA 2006-03-27 10:25:44 EST
Verified for 3.2 M6 using warm-up build I20060327-0010.