-
Notifications
You must be signed in to change notification settings - Fork 8
Format aligned Mappers #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…fic factories to format aligned implementations
src/main/java/org/openrewrite/java/jackson/UseFormatAlignedObjectMappers.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/jackson/UseFormatAlignedObjectMappers.java
Outdated
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/jackson/UseFormatAlignedObjectMappersTest.java
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/jackson/UseFormatAlignedObjectMappers.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/jackson/UseFormatAlignedObjectMappers.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/jackson/UseFormatAlignedObjectMappers.java
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/jackson/UseFormatAlignedObjectMappersTest.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/jackson/UseFormatAlignedObjectMappers.java
Outdated
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/jackson/UseFormatAlignedObjectMappersTest.java
Show resolved
Hide resolved
timtebeek
left a comment
There was a problem hiding this 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
parserClasspathvstestParserClasspath, 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.
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