Skip to content

Conversation

@smals-mavh
Copy link

@smals-mavh smals-mavh commented Jan 30, 2026

Summary by cubic

Add Jackson 3 support alongside Jackson 2 so JsonNullable works on both runtimes. This introduces a Jackson3 module with serializers/deserializers and refactors the Jackson2 implementation to keep compatibility.

  • New Features

    • Jackson 3: JsonNullableJackson3Module with serializers, deserializers, type/value serializer modifiers, and unwrapping writer.
    • Auto-discovery for Jackson 3 via META-INF/services/tools.jackson.databind.JacksonModule.
    • Test coverage for both versions using Jackson2Processor and Jackson3Processor with parameterized tests.
  • Refactors

    • Renamed Jackson 2 classes to JsonNullableJackson2* and wired JsonNullableModule to these implementations.
    • Split BOMs in pom.xml (jackson2-bom and jackson3-bom) and updated module-info and service-loading tests.

Written for commit 00bf11d. Summary will update on new commits.

@smals-mavh smals-mavh closed this Jan 30, 2026
@smals-mavh smals-mavh reopened this Jan 30, 2026
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 36 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="pom.xml">

<violation number="1" location="pom.xml:40">
P2: Jackson 3 requires Java 17+, but the build is pinned to Java 8. Adding the Jackson 3 BOM/tools.jackson dependencies will make builds fail with class file version incompatibility unless the toolchain is upgraded or Jackson 3 is isolated.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

<hibernate-validator.version>7.0.5.Final</hibernate-validator.version>
<jackson-bom.version>2.21.0</jackson-bom.version>
<jackson2-bom.version>2.20.1</jackson2-bom.version>
<jackson3-bom.version>3.0.4</jackson3-bom.version>
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 30, 2026

Choose a reason for hiding this comment

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

P2: Jackson 3 requires Java 17+, but the build is pinned to Java 8. Adding the Jackson 3 BOM/tools.jackson dependencies will make builds fail with class file version incompatibility unless the toolchain is upgraded or Jackson 3 is isolated.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At pom.xml, line 40:

<comment>Jackson 3 requires Java 17+, but the build is pinned to Java 8. Adding the Jackson 3 BOM/tools.jackson dependencies will make builds fail with class file version incompatibility unless the toolchain is upgraded or Jackson 3 is isolated.</comment>

<file context>
@@ -36,7 +36,8 @@
         <hibernate-validator.version>7.0.5.Final</hibernate-validator.version>
-        <jackson-bom.version>2.20.1</jackson-bom.version>
+        <jackson2-bom.version>2.20.1</jackson2-bom.version>
+        <jackson3-bom.version>3.0.4</jackson3-bom.version>
         <javax-validation-api.version>2.0.1.Final</javax-validation-api.version>
         <jakarta-validation-api.version>3.1.1</jakarta-validation-api.version>
</file context>
Fix with Cubic

Copy link
Author

Choose a reason for hiding this comment

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

This is a fair point, however, locally I was able to build (and use) this without any issue. (Obviously I have JDK21 installed, but the maven build had no issues with java.version set to 8)

Copy link

Choose a reason for hiding this comment

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

I guess the .github/workflows should be updated then to JDK17

@smals-mavh
Copy link
Author

Some extra context:

  • Kept the name 'JsonNullableModule' instead of JsonNullableJackson2Module for example to keep some backwards compatibility
  • The jackson library is marked as 'provided' in the pom now (to not have any jackson version conflicts downstream). The disadvantage is that users now need to add jackson to their pom.
    • On that note, we could add jackson-annotations since they're the same for both Jackson2 and Jackson3 for the moment. But might not be super future proof.
  • Parameterized tests are a bit shoe-horned in some places, but to me this seemed to be the 'safest' route to make sure that all tests work with both Jackson versions.
  • Tested in both Spring Boot 3 and Spring Boot 4 projects and had no issues (apart from having to add the jackson libs myself since they're not transitive anymore)

This was referenced Jan 30, 2026
@SirBigoo
Copy link

SirBigoo commented Feb 2, 2026

I'm waiting this PR to be released because I can't migrate to spring 4 without breaking my app behavior... 💯

<hibernate-validator.version>7.0.5.Final</hibernate-validator.version>
<jackson-bom.version>2.21.0</jackson-bom.version>
<jackson2-bom.version>2.20.1</jackson2-bom.version>
<jackson3-bom.version>3.0.4</jackson3-bom.version>
Copy link

Choose a reason for hiding this comment

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

I guess the .github/workflows should be updated then to JDK17

import org.openapitools.jackson.nullable.JsonNullableModule;

module org.openapitools.jackson.nullable {
requires com.fasterxml.jackson.databind;
Copy link

Choose a reason for hiding this comment

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

module name impacted by jackson2->3, so both should probably become optional dependencies:

requires static com.fasterxml.jackson.databind;
requires static tools.jackson.databind;


exports org.openapitools.jackson.nullable;

provides com.fasterxml.jackson.databind.Module with org.openapitools.jackson.nullable.JsonNullableModule;
Copy link

Choose a reason for hiding this comment

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

should add jackson3 module as well

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.

3 participants