Bug 18396 - ant javac target ignores source="1.4" setting inside eclipse
Summary: ant javac target ignores source="1.4" setting inside eclipse
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0 F2   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-05-30 22:09 EDT by Wes Price CLA
Modified: 2002-06-03 10:35 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wes Price CLA 2002-05-30 22:09:54 EDT
Adding source="1.4" to the javac target in my ant build file allows code
containing JDK1.4 assert statements to compile correctly when ant is run outside
the Eclipse environment, but not when the same build file is used by ant from
inside Eclipse.

I've been using the same build file from inside of Eclipse for a while now
[setting build.compiler to "org.eclipse.pde.internal.core.JDTCompilerAdapter" to
get ant-based compiling from inside Eclipse to work], but now that I've started
using jdk1.4's assert statement, the compiler invoked by ant from inside Eclipse
generates syntax errors on the assert statements (exactly the same errors I saw
before changing Java:Compiler:Compliance level to 1.4 in the Preferences window).

Example syntax error:

1. ERROR in
C:\Projects\leave\work\source\java\edu\hawaii\its\leave\peoplesoft\Client.java
(at line 105)
	assert !isConnected() : "connect(): client is already connected";
	       ^
Syntax error on token "!", "=", "*=", "/=", "%=", "+=", "-=", "<<=", ">>=",
">>>=", "&=", "^=", "|=" expected

Eclipse itself compiles this code with no problems, and ant from the command
line using this build file compiles everything as well.  [Ant from inside
eclipse will compile the code if I remove the assert statements, but that's not
the preferred solution.]
Comment 1 Rodrigo Peretti CLA 2002-05-30 22:24:12 EDT
Moving to JDT Core for comments.
Comment 2 Olivier Thomann CLA 2002-05-31 10:58:10 EDT
Which build are you using? Which JDTAntAdapter are you 
targetting?
org.eclipse.pde.internal.core.JDTCompilerAdapter is an old adapter that is 
removed in the latest build.
Please take a newer build and try the following 
property.
<property name="build.compiler" 
value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
The source option is handled 
properly with this new adapter.
Comment 3 Olivier Thomann CLA 2002-05-31 11:01:57 EDT
Please use a newer build and the new adapter to fix your problem. The old one won't be maintain and is 
actually gone in the latest integration build.
Comment 4 Wes Price CLA 2002-05-31 13:22:17 EDT
I'm currently using M5 (20020416).  Most of the builds after that have status red for the Windows 
platform; which build can I use that will fix this problem and be stable enough for daily work?
Comment 5 Olivier Thomann CLA 2002-05-31 13:50:25 EDT
Most of the latest integration builds are stable enough for daily work. You can 
take the latest integration build 0531. We use them to develop Eclipse and they 
will fix your problem with source 1.4. Red status doesn't mean it is useless. 
Some of the tests are failing in case we will never get in real life.
Comment 6 David Audel CLA 2002-06-03 10:34:55 EDT
Verified.