Skip to content

Fix Jackson3JsonPayloadConverter API mismatch in the multi-release jar - #3087

Open
sangkyoonnam wants to merge 2 commits into
temporalio:mainfrom
sangkyoonnam:fix/2885-jackson3-converter-api
Open

sangkyoonnam wants to merge 2 commits into
temporalio:mainfrom
sangkyoonnam:fix/2885-jackson3-converter-api

Conversation

@sangkyoonnam

Copy link
Copy Markdown
Contributor

What was changed

  • The Java 8 stub of Jackson3JsonPayloadConverter now declares the same public API as the Java 17 class: the Jackson3JsonPayloadConverter(JsonMapper) constructor and newDefaultJsonMapper(boolean), both throwing UnsupportedOperationException like the rest of the stub.
  • The main source set gets Jackson 3 as compileOnly so the stub can reference JsonMapper. The published POM is unchanged.
  • Added Jackson3JsonPayloadConverterApiTest to the jackson3Tests suite, comparing the public members of the stub and the Java 17 class.
  • Updated JacksonJsonPayloadConverterTest for 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 plain javac accept it. jar --validate reports 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 throw UnsupportedOperationException, and setDefaultAsJackson3 already catches both and throws the same IllegalStateException with the same message. Using the converter still requires Java 17+ and Jackson 3 on the compile and runtime class path, as before.

Checklist

  1. Closes Jackson3JsonPayloadConverter(JsonMapper) constructor not visible to javac — only present in META-INF/versions/17/ #2885

  2. How was this tested:

    • javac --release 8 against the jar (base entry only) reproduces the error on main and compiles with this change; --release 17 compiles in both cases
    • jar --validate fails on main for this class and passes with this change
    • Jackson3JsonPayloadConverterApiTest fails without the stub change, with the default build and with -PedgeDepsTest, and passes with it
    • JacksonJsonPayloadConverterTest run with only the base classes on the class path (Java 8 to 16 behavior), jackson3Tests, javadoc, spotlessCheck; generated POM identical to main
  3. Any docs updates needed? No

@sangkyoonnam
sangkyoonnam requested a review from a team as a code owner September 17, 2026 12:02
@sangkyoonnam
sangkyoonnam force-pushed the fix/2885-jackson3-converter-api branch from 2f6427d to 92540ec Compare September 17, 2026 12:03

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Jackson3JsonPayloadConverter(JsonMapper) constructor not visible to javac — only present in META-INF/versions/17/

1 participant