Community
Participate
Working Groups
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.]
Moving to JDT Core for comments.
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.
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.
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?
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.
Verified.