Repository navigation
Skip JvmDowngrader stubs that cannot load on Java 9+ - #34
Merged
Merged
Conversation
JvmDowngrader loads its stubs with the bootstrap class loader, which on Java 9+ cannot see the java.net.http and jdk.httpserver modules. Its stubs for methods those modules gained in Java 16, 17, 21 and 25 never load there, and each one logged a NoClassDefFoundError on every agent start. Main now passes -Djvmdg.debug.skipStub for them to the child JVM on Java 9+ (unless set already); behaviour is unchanged. Unit tests: restore System.out after the premain test, so the output of the tests after it is printed again (hidden since the #32 fix).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before: on Java 11 and 17 agents, every start logs one to three
[ClassDowngrader/...] WARN: failed to resolve methods for xyz.wagyourtail.jvmdg.j21.stub.java_net_http.J_N_H_HttpClientwarnings with aNoClassDefFoundError: java/net/http/HttpClientstack trace (reported in #32). Java 8 agents don't log it.After: no such warning. Behaviour is unchanged.
JvmDowngrader loads its stubs with the bootstrap class loader, which on Java 9+ cannot see the
java.net.httpandjdk.httpservermodules. Its stubs for methods those modules gained in Java 16, 17, 21 and 25 (for exampleHttpClient.close()) never load there; JvmDowngrader logs the error and goes on without them. Checked on Temurin 17 with a class compiled for Java 21: callingHttpClient.close()fails withNoSuchMethodErrorwith or without this change, and the warning is gone with it.How: on Java 9+,
Mainpasses-Djvmdg.debug.skipStub=with those stub classes to the child JVM, unless the option is already set. Also: the premain unit test now restoresSystem.out, so the output of the tests after it is printed again (since #33 only the first 5 of the 42 results were printed; they all ran and passed).Refs #32