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

[REPL] Stop old classpath calculation on the base classloader #4363

Closed
wants to merge 1 commit into from

Conversation

ileasile
Copy link
Contributor

@ileasile ileasile commented May 9, 2021

Motivation for this change is given in the comment.

@ileasile ileasile requested a review from ligee May 9, 2021 23:35
@ileasile ileasile force-pushed the rr/ileasile/border-guard-classloader branch from f1a7916 to 6893731 Compare May 10, 2021 17:56
@ileasile ileasile force-pushed the rr/ileasile/border-guard-classloader branch from 6893731 to a07c7a7 Compare May 11, 2021 16:26
@ileasile ileasile changed the title Add BorderGuardClassLoader marker interface [REPL] Stop old classpath calculation on the base classloader May 11, 2021
Copy link
Contributor

@ligee ligee left a comment

Choose a reason for hiding this comment

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

Please add some info in the commit message, e.g. "since the mechanism of the recursive classpath checking is intended for the "inner" scripting/REPL classloaders, and should not touch anything beyond."

@@ -139,17 +140,17 @@ private fun CompiledScript.makeClassLoaderFromDependencies(baseClassLoader: Clas
val processedClasspathElements = mutableSetOf<URL>()
fun recursiveClassPath(res: Sequence<URL>, classLoader: ClassLoader?): Sequence<URL> =
when (classLoader) {
null -> res
null, baseClassLoader -> res
Copy link
Contributor

Choose a reason for hiding this comment

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

I would still process the null case, e.g. generating an error if we've got null.

Copy link
Contributor

Choose a reason for hiding this comment

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

But it should be after baseClassLoader check, since it could be null, and it is a valid situation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ligee I'm not sure that fallbackClassloader of DualClassLoader should necessarily have base classloader as a parent. Is it really so?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As I can see from usages, it is always a thread context classloader that is a base classloader at the same time, so there is no appropriate test

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say it should convert to the baseClassLoader, but since it is possible to replace it, it is safer to leave the code as you wrote it.
About the tests - there are some tests with baseClassLoader set to null, and that's probably it.

@ileasile
Copy link
Contributor Author

Merged manually: bab5d16

@ileasile ileasile closed this May 12, 2021
@Badya Badya deleted the rr/ileasile/border-guard-classloader branch October 27, 2022 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants