Fix Jackson3JsonPayloadConverter API mismatch in the multi-release jar - #3087
Open
sangkyoonnam wants to merge 2 commits into
Open
sangkyoonnam wants to merge 2 commits into
sangkyoonnam wants to merge 2 commits into
Conversation
sangkyoonnam
force-pushed
the
fix/2885-jackson3-converter-api
branch
from
September 17, 2026 12:03
2f6427d to
92540ec
Compare
This branch has not been deployed
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.
What was changed
Jackson3JsonPayloadConverternow declares the same public API as the Java 17 class: theJackson3JsonPayloadConverter(JsonMapper)constructor andnewDefaultJsonMapper(boolean), both throwingUnsupportedOperationExceptionlike the rest of the stub.compileOnlyso the stub can referenceJsonMapper. The published POM is unchanged.Jackson3JsonPayloadConverterApiTestto thejackson3Testssuite, comparing the public members of the stub and the Java 17 class.JacksonJsonPayloadConverterTestfor the linkage error described below.Why?
The multi-release jar spec requires versioned entries of a class to have the same public API. The stub was missing two members, so tools that compile against the base entry (IntelliJ's build system, see IDEA-368688) reject
new Jackson3JsonPayloadConverter(mapper)even though Gradle, Maven and plainjavacaccept it.jar --validatereports the mismatch on the current jar and passes with this change.On Java 8 to 16 without Jackson 3, reflective lookups on the stub now fail while linking (
NoClassDefFoundError) instead of at invocation, because the JVM resolves the parameter types of every constructor. Direct calls to the stub still throwUnsupportedOperationException, andsetDefaultAsJackson3already catches both and throws the sameIllegalStateExceptionwith the same message. Using the converter still requires Java 17+ and Jackson 3 on the compile and runtime class path, as before.Checklist
Closes Jackson3JsonPayloadConverter(JsonMapper) constructor not visible to javac — only present in META-INF/versions/17/ #2885
How was this tested:
javac --release 8against the jar (base entry only) reproduces the error on main and compiles with this change;--release 17compiles in both casesjar --validatefails on main for this class and passes with this changeJackson3JsonPayloadConverterApiTestfails without the stub change, with the default build and with-PedgeDepsTest, and passes with itJacksonJsonPayloadConverterTestrun with only the base classes on the class path (Java 8 to 16 behavior),jackson3Tests,javadoc,spotlessCheck; generated POM identical to mainAny docs updates needed? No