Skip to content

Conversation

@MBoegers
Copy link
Contributor

What's changed?

A recipe is added that moves Jackson 2 code from ObjectMappers with language specific factories to more modern language specific mapper implementations.

What's your motivation?

This move is possible in Jackson 2 and is mandatory for Jackson 3.

Anything in particular you'd like reviewers to focus on?

This is a base PR for the 4 most likely implementations. Later this recipe should be expand to handle all dataformats.

Anyone you would like to review specifically?

Have you considered any alternatives or workarounds?

Any additional context

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

…fic factories to format aligned implementations
@MBoegers MBoegers self-assigned this Dec 15, 2025
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Dec 15, 2025
@openrewrite openrewrite deleted a comment from github-actions bot Dec 15, 2025
@MBoegers MBoegers marked this pull request as ready for review December 15, 2025 12:05
@MBoegers MBoegers requested a review from timtebeek December 15, 2025 12:08
Copy link
Member

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

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

I've pushed a change for a more complete migration; here key points identified in earlier comments

  • Use the correct parserClasspath vs testParserClasspath, or none, where possible, based on usage in src/main vs src/test
  • Remove imports before adding new imports, to avoid conflicts; now also enforced through openrewrite/rewrite-rewrite#46
  • Use preconditions to speed up recipe execution, especially where you already have a method matcher
  • Include your recipe in larger composite recipes, to avoid folks having to seek out and run individually
  • Avoid making needless changes, as we saw with new ObjectMapper()
  • Do no harm in cases with known limitations, such as factories known not supported yet.

Ideally we don't see these issues again in subsequent PRs; I know it can be a lot to keep in mind when writing recipes, but strive to stay ahead of such known issues where possible.

@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Dec 15, 2025
@timtebeek timtebeek merged commit 460aa17 into main Dec 15, 2025
2 checks passed
@timtebeek timtebeek deleted the boeg/format-aligned-mappers branch December 15, 2025 14:33
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants