Bug 300301 - Eclipse compiler chosen complaince level as 1.4 with source 1.4 target 1.5
Summary: Eclipse compiler chosen complaince level as 1.4 with source 1.4 target 1.5
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2.2   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.6 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-21 01:13 EST by Ashok B CLA
Modified: 2010-01-25 06:33 EST (History)
2 users (show)

See Also:


Attachments
Testcase - Build xml file (315 bytes, application/xml)
2010-01-21 01:17 EST, Ashok B CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ashok B CLA 2010-01-21 01:13:39 EST
Build Identifier: M20060921-0945

I am using ANT (version 1.6.2) and eclipse java compiler (version 3.2.2.r322) to compile my java project.

In javac task, I specified target="1.5" and source="1.4" to compile my sources. I am getting an error saying that "[javac] Compliance level '1.4' is incompatible with target level '1.5'. A compliance level '1.5' or better is required"

<javac compiler="org.eclipse.jdt.core.JDTCompilerAdapter" destdir="c:/tmp/bin" target="1.5" source="1.4">

I saw the comptability table in the site http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm
and there it is mentioned that a compliance level of 1.5 can have the source=1.4 and target=1.5

But in my case, compliance level is chosen as 1.4 by default.

 
I have attached build.xml with this entry and I used the following command to execute this build file in the command prompt.

ant -lib c:/tmp/lib

I copied the ecj compiler in c:/tmp/lib directory.

Reproducible: Always

Steps to Reproduce:
1. Get the build.xml file attached with this entry and paste it in C:/test
2. Copy the ecj.jar into C:/tmp/lib directory
3. In the command prompt (goto C:/test directory), execute the following command "ant -lib c:/tmp/lib"
Comment 1 Ashok B CLA 2010-01-21 01:17:15 EST
Created attachment 156759 [details]
Testcase - Build xml file
Comment 2 Olivier Thomann CLA 2010-01-21 09:15:19 EST
If you want to do this, you should add a nested compilearg element inside the javac task.
<project name="buildfile " default="build">
  <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter" />
  <target name="build">
    <mkdir dir="c:/tmp/bin"/>
    <javac destdir="c:/tmp/bin" target="1.5" source="1.4">
<compilerarg compiler="org.eclipse.jdt.core.JDTCompilerAdapter" line="-1.5" />
      <src path="C:/tmp/testlib"/>
    </javac>
   </target>
</project>

You should always set the build.compiler property.
Closing as INVALID as the problem comes from a wrong way to invoke the batch compiler. Reopen if the code above doesn't fix your issue.
Comment 3 Srikanth Sankaran CLA 2010-01-25 06:33:37 EST
Verified for 3.6M5