Bug 165976 - ECJ Ant adapter doesn't allow setting empty bootclasspath
Summary: ECJ Ant adapter doesn't allow setting empty bootclasspath
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-27 16:43 EST by Tim Ellison CLA
Modified: 2007-02-15 09:37 EST (History)
2 users (show)

See Also:


Attachments
Proposed fix (2.94 KB, patch)
2006-11-27 23:19 EST, Olivier Thomann CLA
no flags Details | Diff
New patch (3.08 KB, patch)
2006-11-28 12:06 EST, 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 Tim Ellison CLA 2006-11-27 16:43:49 EST
Why does the Ant adapter code for the Eclipse Java compiler set the includejavaRuntime to true when the bootclasspath is defined to be empty? (even if that attribute is explicitly set false)?

How can I invoke the compiler with an empty bootclasspath?  This is require for Apache Harmony where all the types are being compiled from source, and there are no class files required.

ref: http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java?rev=1.65&content-type=text/vnd.viewcvs-markup
Comment 1 Olivier Thomann CLA 2006-11-27 16:53:31 EST
I'll look at this. When do you need a fix for this?
Comment 2 Tim Ellison CLA 2006-11-27 17:20:09 EST
We have a workaround by setting a bogus bootclasspath, so no mad rush.
Comment 3 Olivier Thomann CLA 2006-11-27 23:18:43 EST
The fix would be to remove the this.includeJavaRuntime= true when no bootclasspath has been specified.
But we also need to solve the case where the batch compiler is trying to retrieve the libraries from the VM that is running the batch compiler when no bootclasspath has been specified.
We should set an empty bootclasspath without reporting an incorrect classpath.
-bootclasspath "" would mean no libraries. So if java.lang.Object is not part of the compilation units to compile, the compilation will fail.
Comment 4 Olivier Thomann CLA 2006-11-27 23:19:29 EST
Created attachment 54605 [details]
Proposed fix

I'll do more testing tomorrow.
Comment 5 Olivier Thomann CLA 2006-11-28 12:06:27 EST
Created attachment 54648 [details]
New patch

With this patch, bootclasspath="" in the javac task would mean that there is no bootclasspath and the batch compiler won't try to retrieve it from the underlying VM.
Would this fix your issue?
Comment 6 Philipe Mulet CLA 2006-11-28 12:19:21 EST
+1 for 3.2.2 (if proven to be required)
Comment 7 Olivier Thomann CLA 2006-11-28 12:20:27 EST
Do you need a fix for 3.2.2 or 3.3. only?
Comment 8 Olivier Thomann CLA 2006-11-28 12:39:44 EST
Released for 3.3M4.
Tim, let us know if this is required for 3.2.2.
Comment 9 Tim Ellison CLA 2006-11-28 16:00:47 EST
Fix in 3.3 stream only is fine -- thanks.
Comment 10 Tim Ellison CLA 2006-12-13 15:19:08 EST
Verified on I20061211-0010.

Setting <bootclasspath/> within the <javac ...> task produced:
    ...
    [javac] Compiling 1 source file to C:\Harmony\build\classes
    [javac] Using JDT compiler
    [javac] Compilation arguments:
    [javac] '-noExit'
    [javac] '-bootclasspath'
    [javac] ''
    [javac] '-classpath'
    [javac] 'C:\Harmony\build\classes;
    ...

Which is what I expected.  Thanks.
Comment 11 Philipe Mulet CLA 2006-12-14 07:05:32 EST
Thanks for the assessment