Skip to content

Migrate to Java 17 and Jackson 3 - #2047

Open
gregjotau wants to merge 3 commits into
Adyen:mainfrom
beint-no:jackson-3-java-17
Open

Migrate to Java 17 and Jackson 3#2047
gregjotau wants to merge 3 commits into
Adyen:mainfrom
beint-no:jackson-3-java-17

Conversation

@gregjotau

@gregjotau gregjotau commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the next-major direction proposed in #1899:

  • make Java 17 the minimum supported runtime and compiler release
  • migrate Jackson core/databind usage from com.fasterxml.jackson 2.x to tools.jackson 3.x
  • retain com.fasterxml.jackson.core:jackson-annotations 2.x, which Jackson 3 intentionally continues to use
  • migrate handwritten serializers, deserializers, mapper configuration, tests, and the v7 generation templates
  • reject accidental legacy Jackson 2 core/databind/datatype/module dependencies with Maven Enforcer
  • test the supported JDK matrix on 17, 21, and 25

The generator companion is Adyen/adyen-sdk-automation#154. It now keeps OpenAPI Generator 7.11.0 and adds only the import mapping needed by Adyen's existing custom Jersey 3 templates. This avoids coupling the Jackson migration to unrelated output changes from an OpenAPI Generator upgrade.

Compatibility notes

This is intentionally a breaking, next-major change. Applications must run on Java 17 or newer. Jackson 3 exceptions and mapper APIs are used where Jackson 2 types no longer exist; annotations keep their com.fasterxml.jackson.annotation package because that artifact remains shared with Jackson 3.

Regression coverage

Focused Jackson 3 tests now cover:

  • rebuilding a mapper after setDateFormat, including preservation of modules and configuration
  • visibility of the volatile mapper during concurrent reads and reconfiguration
  • generated oneOf deserialization
  • UTF-8 byte-array serialization and deserialization round trips

The byte-array serializer now uses UTF-8 explicitly, matching the deserializer and removing platform-default behavior.

Generation reproducibility

  • ./gradlew :java:cleanRepo :java:sessionauthentication in the automation companion regenerates a clean library worktree against this branch with OpenAPI Generator 7.11.0.
  • ./gradlew :java:services succeeds against the requested OpenAPI schema commit bee086f without any Jackson 2 core/databind imports.
  • The full-services run has 13 tracked changes and 21 new generated paths from API snapshot drift already present with 7.11.0. The library's current baseline commit generated only the payment service, so those unrelated service updates are not included here.

Validation

  • 622 tests discovered: 618 passed and 4 existing tests skipped
  • mvn -Dgpg.skip=true clean verify
  • mvn dependency:analyze -DfailOnWarning=true
  • focused Jackson 3 regression tests also pass on JDK 25
  • ./gradlew :buildSrc:test in the generator companion
  • clean downstream ReAI Spring Boot 4 application build using the published compatibility artifact

@gregjotau
gregjotau requested a review from a team as a code owner August 23, 2026 05:42

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request upgrades the project's runtime baseline to Java 17 and migrates the serialization framework from Jackson 2 to Jackson 3, updating imports, exception types, and custom deserializers across all model files. The review feedback identifies opportunities to simplify the JsonMapper configuration using cleaner Jackson 3 builder APIs and highlights a thread-safety issue where a shared static mapper is reassigned concurrently in setDateFormat across multiple packages.

Comment thread src/main/java/com/adyen/model/acswebhooks/JSON.java
Comment thread src/main/java/com/adyen/model/acswebhooks/JSON.java
Comment thread src/main/java/com/adyen/model/balancecontrol/JSON.java
Comment thread src/main/java/com/adyen/model/balancecontrol/JSON.java
Comment thread src/main/java/com/adyen/model/balanceplatform/JSON.java
Comment thread src/main/java/com/adyen/model/balanceplatform/JSON.java
Comment thread src/main/java/com/adyen/model/binlookup/JSON.java
Comment thread src/main/java/com/adyen/model/binlookup/JSON.java
Comment thread src/main/java/com/adyen/model/balancewebhooks/JSON.java
Comment thread src/main/java/com/adyen/model/balancewebhooks/JSON.java
@gregjotau

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I addressed the valid mapper visibility concern in 98125da: the generated ObjectMapper reference is now volatile in the template and all current generated copies.

I kept changeDefaultPropertyInclusion(...) because Jackson Databind 3.1.5's MapperBuilder exposes that API but does not expose the suggested serializationInclusion(...) method.

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.

1 participant