Bug 195509 - Need to improve classpath resolution for Apache Harmony in org/eclipse/jdt/core/tests/util/Util.java
Summary: Need to improve classpath resolution for Apache Harmony in org/eclipse/jdt/co...
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.1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-05 06:28 EDT by Nina Rinskaya CLA
Modified: 2008-09-16 09:46 EDT (History)
2 users (show)

See Also:


Attachments
Patch fixes Harmony classpath issue (1.63 KB, patch)
2007-07-05 06:29 EDT, Nina Rinskaya CLA
no flags Details | Diff
Proposed fix (4.28 KB, patch)
2007-07-05 10:12 EDT, Olivier Thomann CLA
no flags Details | Diff
Better fix (5.15 KB, patch)
2007-07-05 10:44 EDT, Olivier Thomann CLA
no flags Details | Diff
Proposed fix + regression test (14.26 KB, patch)
2007-07-05 13:27 EDT, 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 Nina Rinskaya CLA 2007-07-05 06:28:31 EDT
I'm opening this bug in order to suggest an improvement for https://bugs.eclipse.org/bugs/show_bug.cgi?id=172820 fix.

The patch from https://bugs.eclipse.org/bugs/show_bug.cgi?id=172820 is not quite correct: it composes the classpath for Apache Harmony by
collecting all jars from $JRE/lib/boot, but it's not quite correct. The better
way is to collect all jars from System.getProperty("sun.boot.class.path") -
this is where Harmony stores its classpath entries. Otherwise some stub jars
from $JRE/lib/boot that are not supposed to be used are put to the classpath,
and the $JRE/bin/default/kernel.jar that introduces almost all kernel API is
missed. In this case some Eclipse Automated tests fail
(org.eclipse.jdt.core.tests.compiler.regression.GenericTypeTest.test0641 - 1.5,
org.eclipse.jdt.core.tests.compiler.regression.GenericTypeTest.test0800 - 1.5)
because Eclipse compiler uses this wrong classpath. 

The same issue for org/eclipse/jdt/internal/compiler/batch/Main.java was fixed
in https://bugs.eclipse.org/bugs/show_bug.cgi?id=188648 - please see the patch
attached to this issue, it looks to resolve the classpath correctly. But some
tests call
org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.getDefaultClassPaths()
to compose the classpath for compiler and sometimes the stub jar-s in the
classpath cause incorrect behavior.

I'm attaching the simple patch that substitutes correct classpath for Harmony,
but could you also please review the patch for
https://bugs.eclipse.org/bugs/show_bug.cgi?id=188648? Thank you!
Comment 1 Nina Rinskaya CLA 2007-07-05 06:29:06 EDT
Created attachment 73099 [details]
Patch fixes Harmony classpath issue
Comment 2 Olivier Thomann CLA 2007-07-05 08:41:25 EDT
Philippe,

ok for 3.3.1?
Comment 3 Olivier Thomann CLA 2007-07-05 10:12:16 EDT
Created attachment 73117 [details]
Proposed fix

I propose this patch instead.
This would match what is done in the batch compiler for all VMs. The bootclasspath property should be used for all VMs, if not found we would revert to the existing heuristic.
Comment 4 Olivier Thomann CLA 2007-07-05 10:44:10 EDT
Created attachment 73122 [details]
Better fix

This new patch makes sure that all entries in the bootclasspath property exist. Surprisingly this is not always the case.
Comment 5 Olivier Thomann CLA 2007-07-05 10:49:04 EDT
(In reply to comment #0)
> I'm attaching the simple patch that substitutes correct classpath for Harmony,
> but could you also please review the patch for
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=188648? Thank you!
Did you find something wrong with the patch for bug 188548 ?

Comment 6 Olivier Thomann CLA 2007-07-05 11:11:06 EDT
Released for 3.4M1.
Comment 7 Philipe Mulet CLA 2007-07-05 12:52:44 EDT
+1 for 3.3.1
Comment 8 Olivier Thomann CLA 2007-07-05 13:27:56 EDT
Created attachment 73141 [details]
Proposed fix + regression test

I had to update a test in the builder tests that made the assumption that classlibs length was 1.
So this is the same fix + corresponding test updated.
Comment 9 Olivier Thomann CLA 2007-07-05 13:42:39 EDT
Released for 3.3.1.
Regression tests updated.
Comment 10 Nina Rinskaya CLA 2007-07-06 02:36:10 EDT
The issue is not reproducible on Harmony with the latest version from CVS (HEAD). Thanks.
Comment 11 Olivier Thomann CLA 2007-07-06 09:38:04 EDT
You might want to use the version from branch R3_3_maintenance.
Comment 12 Nina Rinskaya CLA 2007-07-10 23:59:34 EDT
I actually don't have the Eclipse Automated sources from CVS, just the sources packed into binary bundle (eclipse-Automated-Tests-3.2.zip/eclipse-Automated-Tests-3.3.zip), so I just copy-pasted the lines that were changed from http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java?view=markup, hope that's ok.
Comment 13 Frederic Fusier CLA 2007-08-07 06:39:39 EDT
Code verified for 3.4M1 using build I20070806-1800.
Comment 14 Eric Jodet CLA 2007-09-03 10:25:01 EDT
Code verified for 3.3.1 using build M20070831-2000