slachiewicz opened a new issue, #3618: URL: https://github.com/apache/maven-surefire/issues/3618
Affected version: master at d7c7e359e. `IsolatedClassLoader` declares a field `parent` initialized to `ClassLoader.getSystemClassLoader()` (surefire-booter/src/main/java/org/apache/maven/surefire/booter/IsolatedClassLoader.java:30) which shadows the constructor parameter passed to `super(EMPTY_URL_ARRAY, parent)` at line 41. In child-delegation mode the fallback at line 75 therefore delegates to the system class loader rather than the parent supplied to the constructor. Production is mostly unaffected because `childDelegation` defaults to `false` (maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java:589), so `super.loadClass` with the constructor parent is used. Operators who enable child delegation, however, get a different and undocumented hierarchy. Expected behavior: store the constructor-supplied parent in the field (or remove the shadowing field) so child delegation falls back to the configured parent. A unit test can construct the loader with a sentinel parent and assert which loader handles a class not found in the child URLs. -- 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]
