dhananjay6561 opened a new pull request, #3635: URL: https://github.com/apache/maven-surefire/pull/3635
Fixes #3618. `IsolatedClassLoader` had its own `parent` field set to `ClassLoader.getSystemClassLoader()`, which shadowed the parent passed to the constructor. With `childDelegation` on, a class not found in the loader's own URLs was then looked up in the system class loader instead of the configured parent (the platform class loader from `Classpath.createClassLoader`). This removes the shadowing field and falls back to `super.loadClass(name)`, so child delegation uses the same parent as the default parent-first mode. A plain `this.parent = parent` would not be enough, because on Java 8 `SystemUtils.platformClassLoader()` returns `null` and the old `parent == null` branch would then fail to load JDK classes. `super.loadClass` goes to the bootstrap loader in that case. Tests added to `IsolatedClassLoaderTest`: - child delegation finds a class that only the given parent knows about - child delegation with a `null` parent still loads `java.lang.String` --- To make clear that you license your contribution under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) check one of the following: - [x] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) - [ ] I hereby declare that I have filed an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
