Bug 563530 - [9] -Xbootclasspath/a should still be supported
Summary: [9] -Xbootclasspath/a should still be supported
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.7.1a   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.16 RC1   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks: 562556
  Show dependency tree
 
Reported: 2020-05-24 16:03 EDT by Stephan Herrmann CLA
Modified: 2020-05-26 13:23 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 Stephan Herrmann CLA 2020-05-24 16:03:10 EDT
Since bug 518866 Java 9+ projects can no longer append to the bootclasspath, although this is still legal in Java 9.

Prior to Java 9 this used to work as follows:

AbstractJavaLaunchConfigurationDelegate.getBootpathExt() detects the System Library using the property IRuntimeClasspathEntry.STANDARD_CLASSES. Then, all entries with property IRuntimeClasspathEntry.BOOTSTRAP_CLASSES that come after the System Library are detected as *appending* to the bootclasspath.

Since bug 518866, however, the System Library is marked as IRuntimeClasspathEntry.MODULE_PATH or IRuntimeClasspathEntry.CLASS_PATH, i.e., IRuntimeClasspathEntry.STANDARD_CLASSES is no longer used.

As a result, configurations that should use -Xbootclasspath/a use plain -Xbootclasspath causing the JVM to throw an error:
-Xbootclasspath is no longer a supported option.


For a moment I was blaming bug 522696, but signaling -Xbootclasspath and -Xbootclasspath/p is correct. No change required in that area.
Comment 1 Eclipse Genie CLA 2020-05-24 16:44:29 EDT
New Gerrit change created: https://git.eclipse.org/r/163496
Comment 2 Stephan Herrmann CLA 2020-05-24 16:55:18 EDT
(In reply to Eclipse Genie from comment #1)
> New Gerrit change created: https://git.eclipse.org/r/163496

Here's a simple fix: don't rely on IRuntimeClasspathEntry.STANDARD_CLASSES (because it no longer occurs in Java 9+), but directly ask JavaRuntime.isVMInstallReference(entry), which is used right here anyway.

I would love to provide a unit test, but that would involve creating a byte code transformer that inserts references to a library classes into classes from arbitrary class loaders. That library, to be available *everywhere* must be added to the bootclasspath.

I don't think JDT/Debug tests have the infrastructure for byte code transformation, do they?


I'd love to see this fix in RC1, if people agree that the patch is safe.

The bug breaks running OT/J applications on Java 9 (see bug 562556). Other tools using byte code transformations will likely face the same problem.

OTOH, to be fair, I should mention that I can workaround this bug, using OT/J adaptation of JDT/Debug :) - so it's not a serious blocker.
Comment 3 Stephan Herrmann CLA 2020-05-25 14:51:42 EDT
Sarika, do you have a minute to look at the patch and give +1 for RC1?
Comment 4 Sarika Sinha CLA 2020-05-26 02:37:06 EDT
(In reply to Stephan Herrmann from comment #3)
> Sarika, do you have a minute to look at the patch and give +1 for RC1?

+1 for RC1.

For unit test case, do we really need byte code transformer?
BootpathTests can be enhance to have a Java 9 non modular project to verify ?
Comment 5 Stephan Herrmann CLA 2020-05-26 06:59:28 EDT
(In reply to Sarika Sinha from comment #4)
> (In reply to Stephan Herrmann from comment #3)
> > Sarika, do you have a minute to look at the patch and give +1 for RC1?
> 
> +1 for RC1.

thanks

> For unit test case, do we really need byte code transformer?
> BootpathTests can be enhance to have a Java 9 non modular project to verify ?

That's exactly what I need, thanks. Will create a test case later today.
Comment 6 Stephan Herrmann CLA 2020-05-26 11:12:45 EDT
Patch set #2 adds a test by making BootpathTests capable for running on Java 9+, and enabling it on all versions (in AutomatedSuite). New test added to this suite for append.

Interestingly, without the fix all four contained tests fail on 9+. With the fix only one case test produces different results (empty array vs. null). Made this a conditional test expectation for now.

Later we might also check, if testPrependBootpath() should actually raise some kind of error on 9+.
Comment 8 Sarika Sinha CLA 2020-05-26 12:53:36 EDT
(In reply to Stephan Herrmann from comment #6)
> Patch set #2 adds a test by making BootpathTests capable for running on Java
> 9+, and enabling it on all versions (in AutomatedSuite). New test added to
> this suite for append.
> 
> Interestingly, without the fix all four contained tests fail on 9+. With the
> fix only one case test produces different results (empty array vs. null).
> Made this a conditional test expectation for now.
> 
> Later we might also check, if testPrependBootpath() should actually raise
> some kind of error on 9+.

Please open a bug to track this.
Comment 9 Stephan Herrmann CLA 2020-05-26 13:23:46 EDT
Thanks, Sarika, for merging.

I file bug 563602 for final polish in this area.