Bug 69931 - JDTCompilerAdapter prevents use of Cheetah
Summary: JDTCompilerAdapter prevents use of Cheetah
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-13 11:02 EDT by Markus Stier CLA
Modified: 2005-01-11 11:02 EST (History)
0 users

See Also:


Attachments
Here is the source patch to apply on HEAD (706 bytes, patch)
2004-07-13 16:00 EDT, Olivier Thomann CLA
no flags Details | Diff
Here is the binary patch. (9.03 KB, application/octet-stream)
2004-07-13 16:02 EDT, Olivier Thomann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Stier CLA 2004-07-13 11:02:05 EDT
I tried to set up an ant build script which uses Cheetah rev. 006 to compile my 
sources based on JRE 1.5. 

Unfortunately the switch "-1.5" is not yet enabled in the method 
setupJavacCommand() of JDTCompilerAdapter.class.
There is a hardcoded comparison to JAVA_1_4 too, which leads to a "-1.3" if 
your environment is 1.5.
Comment 1 Olivier Thomann CLA 2004-07-13 14:58:19 EDT
I will investigate.
Comment 2 Olivier Thomann CLA 2004-07-13 16:00:53 EDT
Created attachment 13218 [details]
Here is the source patch to apply on HEAD

Let me know if it works fine.
Comment 3 Olivier Thomann CLA 2004-07-13 16:02:00 EDT
Created attachment 13219 [details]
Here is the binary patch.

Override the existing file in the jdt.core plugin
Comment 4 Markus Stier CLA 2004-07-14 03:43:50 EDT
Works fine for me. Thanks for the fast response and solution!

I only wonder if it is desired not to be able to define the compliance via "-
1.3", "-1.4" and "-1.5" from within an ant script. 

Comment 5 Olivier Thomann CLA 2004-07-14 09:56:14 EDT
We thought about it, but we decided that it was more convenient to set the
compliance according to the VM used to run the batch compiler. The other
solution would be to do it using the compilerarg nested element. The problem is
that we don't control what options are available for the javac ant task.
Is this fine for you?
Comment 6 Markus Stier CLA 2004-07-14 11:46:37 EDT
I agree that the current behaviour is convenient. It would have saved me some 
time if the adapter would have produced a warning like "Unknown VM Version, 
default compliance used". In addtion it should generate a warning if you 
specify a compliance at all (like "compliance is set according to VM: ignoring 
<-1.5>"). The errormessage which comes from the batch compiler itself wasn't 
useful ("duplicate compliance setting specification: -1.5").
Comment 7 Olivier Thomann CLA 2004-07-14 16:40:05 EDT
I can change the way to ant adapter is working and then you would have a way to
set the compliance level inside the compilerarg. It would not be set anymore
using the VM used to run the build. Then you would not end up with the error
message you got.
Any suggestion is appreciated. The compliance level is something specific to the
Eclipse compiler, because it has to behave like javac 1.3, javac 1.4 or javac
1.5. javac doesn't have this issue. The compliance level is implicitely the one
for the javac version you are running.
We wanted to make it as easy as possible to set up right.
I can add this warning if you want:
"Unknown VM Version, default compliance used"
But I still believe it should be set without user interference.
Comment 8 Markus Stier CLA 2004-07-15 03:51:00 EDT
I agree that usage should be as convenient as possible.
I started trying the "-1.5" switch after having read the documentation provided 
in http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/jdt-core-
home/howto/batch%20compile/batchCompile.html.
I didn't know that it is set automatically. 
I suggest you add warnings like "Unknown VM Version, default compliance used" 
and "Compliance is set according to VM, compliance switch ignored". That would 
give a good feedback to what is happening.
Comment 9 Olivier Thomann CLA 2004-07-26 17:10:29 EDT
I added the warning "Unknown VM Version, default compliance used" in which case
I don't set any compliance (the default one is used).
I might also change the batch compiler to allow two compliance settings on the
same command line. The last one would be the one used to compile and a warning
would be reported if two are specified.
Comment 10 Olivier Thomann CLA 2004-07-27 12:11:08 EDT
The solution we will adopt is to add an extra argument in the constructor of the
batch compiler to pass custom default arguments. The "guessed" compliance would
simply be a new default. Therefore if none are specified in the nested compiler
argument, the new default would be used. Otherwise the one that the user
specified would be the one used for the compilation.
Do you like this solution?
Comment 11 Olivier Thomann CLA 2004-07-28 20:20:16 EDT
The solution with a new argument that sets the custom options is flexible enough
to enable any argument in the nested compiler argument.
Fixed and released in HEAD.