Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javabootclasspath supersedes jrt #10336

Merged

Conversation

som-snytt
Copy link
Contributor

To compile against a JDK 8 rt.jar, use -javabootclasspath rt.jar -nobootcp.

That disables the jrt class path for the ambient JDK, and puts the Scala libraries on the user class path.

(Alternatively, -usebootcp but list the libraries explicitly on -javabootclasspath.)

Fixes scala/bug#12257

@scala-jenkins scala-jenkins added this to the 2.13.11 milestone Mar 6, 2023
@som-snytt
Copy link
Contributor Author

Tested manually with -javabootclasspath ~/.sdkman/candidates/java/8.0.232-trava/jre/lib/rt.jar.

t12257b.scala:12: error: value getParams is not a member of java.security.interfaces.RSAPublicKey
    case rsa: RSAPublicKey => rsa.getParams
                                  ^

No automated test because it requires the old rt.jar which one is reluctant to put in the git repo.

It's reasonable to make jrt and -javabootclasspath mutually exclusive. (Note javac restricts --boot-class-path to JDK 8.)

https://docs.oracle.com/en/java/javase/19/docs/specs/man/javac.html#standard-options

@som-snytt som-snytt added the release-notes worth highlighting in next release notes label Mar 6, 2023
@som-snytt som-snytt marked this pull request as ready for review March 6, 2023 21:18
@som-snytt
Copy link
Contributor Author

@lrytz intentionally 2.13.11

@som-snytt
Copy link
Contributor Author

Something about CI turns my quickie PR into a burner.

@som-snytt som-snytt marked this pull request as draft March 7, 2023 08:54
@som-snytt som-snytt force-pushed the issue/12257-compile-against-rt-jar branch from a1fed90 to f69089c Compare March 11, 2023 00:34
@som-snytt
Copy link
Contributor Author

som-snytt commented Mar 11, 2023

Corrected to use javaBootClassPath on JDK 8 as intended. On JDK 9+, use jrt unless user has specified -javabootclasspath.

Tested bootstrapped testAll under JDK 8.

Thanks Seth for cancelling the unhappy build.

@som-snytt som-snytt marked this pull request as ready for review March 11, 2023 00:48
@SethTisue SethTisue requested a review from lrytz March 13, 2023 21:51
@SethTisue
Copy link
Member

on the one hand, this looks reasonable, and thanks @som-snytt for including the manual testing details

otoh this whole business isn't business I've been mixed up in before, so I'm not confident in my reviewing. maybe I can interest @retronym

@retronym
Copy link
Member

retronym commented Mar 14, 2023

I think this makes sense and seems unlikely to break existing builds.

@lrytz
Copy link
Member

lrytz commented Mar 28, 2023

Current 2.13.x gives me

➜ sandbox ../build/quick/bin/scalac Test.scala
error: error while loading Object, Missing dependency 'object scala.native in compiler mirror', required by /modules/java.base/java/lang/Object.class
error: scala.reflect.internal.MissingRequirementError: object scala in compiler mirror not found.
	at scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:24)

Reverting this PR fixes it.

@lrytz
Copy link
Member

lrytz commented Mar 28, 2023

#10350 also fixes it.

@som-snytt
Copy link
Contributor Author

I meant to joke that indeed

seems unlikely to break existing builds.

You just can't run scalac.

@SethTisue SethTisue changed the title javabootclasspath supersedes jrt javabootclasspath supersedes jrt Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes worth highlighting in next release notes
Projects
None yet
5 participants