Bug 286391 - [compiler] jsr14 target behavior changed between ECJ 3.4.2 and ECJ 3.5
Summary: [compiler] jsr14 target behavior changed between ECJ 3.4.2 and ECJ 3.5
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.5.1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-12 09:54 EDT by Daniel Le Berre CLA
Modified: 2009-09-15 09:08 EDT (History)
3 users (show)

See Also:


Attachments
Proposed fix (1.07 KB, patch)
2009-08-25 16:32 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Le Berre CLA 2009-08-12 09:54:21 EDT
I use ECJ to compile SAT4J from 1.5 source code to 1.4 bytecode.
(I use the -source 1.5 and -target jsr14 parameters)

I have two bundles: org.sat4j.core and org.sat4j.pb.

The first bundle compiles fine and results in the org.sat4j.core.jar bundle.

For the second one, I have hundreds of error of the form:

The type XXX is not generic; it cannot be parameterized with arguments YYY

I can understand that all information related to generic code in org.sat4j.core has been removed by the compiler, thus that error.

However, I can compile that code without problem with ECJ 3.4.2.

The source code of SAT4J is available at:

svn://svn.forge.objectweb.org/svnroot/sat4j/maven

The ant build file launches the compilation using ECJ and shows the problem.
Comment 1 Olivier Thomann CLA 2009-08-12 10:10:46 EDT
The problem comes from the fact that the second compilation is using the .class files from the first one.
Since the target is 1.4, there is no reason to preserve the Signature attributes. This is what has changed between 3.4.2 and 3.5.

Could you please try to put the source files of the first project on the classpath of the second project before the binaries?
Comment 2 Olivier Thomann CLA 2009-08-18 18:57:55 EDT
Kent, if I revert the change to remove the Signature attribute from the .class files I think this problem is gone.
Do you see another way to solve it ?

Daniel, did you try the suggestion in comment 1?
Comment 3 Daniel Le Berre CLA 2009-08-19 12:57:00 EDT
Olivier,

I added jar files with the source code of my files in the classpath before the jars containing the class files.

Unfortunately, it does not solve the problem.
Comment 4 Olivier Thomann CLA 2009-08-19 12:59:52 EDT
Could you please provide the changes you made?
I'd like to investigate this issue more deeply before putting back an attribute that should not be there with the 1.4 target.
Comment 5 Olivier Thomann CLA 2009-08-24 15:17:19 EDT
(In reply to comment #3)
> I added jar files with the source code of my files in the classpath before the
> jars containing the class files.
Did you add that jar as a sourcepath or as part of the classpath ?
Comment 6 Daniel Le Berre CLA 2009-08-25 16:09:50 EDT
I changed the classpath:

Here is the way I define the classpath in my ant build script:

<path id="somePath">
		<pathelement location="${build}"/>
		<fileset dir="${lib}">
			<include name="*src.jar"/>
		</fileset>
        <fileset dir="${lib}">
			<include name="*.jar"/>
            <exclude name="*src.jar"/>
		</fileset>
		<fileset dir="${dist}/${release}">
			<include name="*.jar"/>
		</fileset>
		<pathelement location="${java.home}/lib/javaws.jar"/> 
	</path>

Here is the full command line of the compiler:
   [javac] Using JDT compiler
dropping /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/javaws.jar from path as it doesn't exist
    [javac] Compilation arguments:
    [javac] '-noExit'
    [javac] '-classpath'
    [javac] '/Users/leberre/MAVEN/bin:/Users/leberre/MAVEN/lib/commons-beanutils.jar:/Users/leberre/MAVEN/lib/commons-cli.jar:/Users/leberre/MAVEN/dist/2.1.1/org.sat4j.core-src.jar:/Users/leberre/MAVEN/dist/2.1.1/org.sat4j.core.jar:/usr/share/ant/lib/ant-launcher.jar:/Users/leberre/.ant/lib/ecj-3.5.jar:/usr/share/ant/lib/ant-antlr.jar:/usr/share/ant/lib/ant-jai.jar:/usr/share/ant/lib/ant-jmf.jar:/usr/share/ant/lib/ant-junit.jar:/usr/share/ant/lib/ant-nodeps.jar:/usr/share/ant/lib/ant-swing.jar:/usr/share/ant/lib/ant-testutil.jar:/usr/share/ant/lib/ant-trax.jar:/usr/share/ant/lib/ant.jar:/usr/share/ant/lib/junit-4.5.jar:/usr/share/ant/lib/xercesImpl.jar:/usr/share/ant/lib/xml-apis.jar:/Users/leberre/MAVEN/org.sat4j.pb/src/main/java'
    [javac] '-d'
    [javac] '/Users/leberre/MAVEN/bin'
    [javac] 

you can check that org.sat4j.core-src.jar appears right before org.sat4j.core.jar.
Comment 7 Olivier Thomann CLA 2009-08-25 16:32:10 EDT
Created attachment 145589 [details]
Proposed fix

Ok, I think I should revert the change that removed the Signature attribute in case the target is lower or equals to 1.5.
Daniel, could you please try this patch ?
Comment 8 Daniel Le Berre CLA 2009-08-25 17:24:32 EDT
Olivier,

Could you attach a patched jar file of the compiler?

I do not have a workspace with the JDT compiler yet :)
Comment 9 Olivier Thomann CLA 2009-08-25 21:17:01 EDT
Fixed by reverting fix for bug 277372.
Comment 10 Daniel Le Berre CLA 2009-08-27 10:04:07 EDT
The fix works perfectly in ecj-M20090826-1100.jar.
Comment 11 Olivier Thomann CLA 2009-08-27 15:22:28 EDT
Verified by reporter for 3.5.1RC2.
Comment 12 Olivier Thomann CLA 2009-08-28 11:35:24 EDT
Verified.
Comment 13 Jay Arthanareeswaran CLA 2009-09-15 07:01:03 EDT
Verified for 3.6M2 using build I20090914-1800