Skip to content

repl: Use the correct parent Classloader on Java 9+ #11658

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

Merged
merged 2 commits into from
Mar 8, 2021

Conversation

smarter
Copy link
Member

@smarter smarter commented Mar 8, 2021

On Java 9+, null as a parent of a URLClassLoader means the parent is
the bootstrap classloader which doesn't contain modules like java.sql,
explicitly use the system classloader instead.

Fixes #11646.

smarter added 2 commits March 8, 2021 19:05
On Java 9+, `null` as a parent of a URLClassLoader means the parent is
the bootstrap classloader which doesn't contain modules like `java.sql`,
explicitly use the platform classloader instead.

Fixes scala#11646.
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@smarter smarter merged commit 0dbe970 into scala:master Mar 8, 2021
@smarter smarter deleted the repl-classloader branch March 8, 2021 21:42
ckipp01 added a commit to ckipp01/metals that referenced this pull request Mar 25, 2021
Instead of passing in `null` when we extend ClassLoader in our
MdocClassLoader this passes in the actual parent since on Java +9 when
using `null` that's the bootstrap classloader which doesn't contain
modules like java.sql.

Bit thanks to @smarter pointing this out in scala/scala3#11658.

Fixes scalameta#2187
ckipp01 added a commit to ckipp01/metals that referenced this pull request Mar 25, 2021
Instead of passing in `null` when we extend ClassLoader in our
MdocClassLoader this passes in the actual parent since on Java +9 when
using `null` that's the bootstrap classloader which doesn't contain
modules like java.sql.

Bit thanks to @smarter pointing this out in scala/scala3#11658.

Fixes scalameta#2187
ckipp01 added a commit to ckipp01/metals that referenced this pull request Mar 25, 2021
Instead of passing in `null` when we extend ClassLoader in our
MdocClassLoader this passes in the actual parent since on Java +9 when
using `null` that's the bootstrap classloader which doesn't contain
modules like java.sql.

Big thanks to @smarter pointing this out in scala/scala3#11658.

Fixes scalameta#2187
ckipp01 added a commit to ckipp01/metals that referenced this pull request Mar 25, 2021
Instead of passing in `null` when we extend ClassLoader in our
MdocClassLoader this passes in the actual parent since on Java +9 when
using `null` that's the bootstrap classloader which doesn't contain
modules like java.sql.

Big thanks to @smarter pointing this out in scala/scala3#11658.

Fixes scalameta#2187
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ClassNotFoundException when using java.sql package of JDK11
4 participants