-
Notifications
You must be signed in to change notification settings - Fork 110
Handle JaxbAnnotationIntrospector and JacksonJsonProvider in migration
#936
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
Handle JaxbAnnotationIntrospector and JacksonJsonProvider in migration
#936
Conversation
| newFullyQualifiedTypeName: com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationIntrospector | ||
| - org.openrewrite.java.ChangeType: | ||
| oldFullyQualifiedTypeName: com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider | ||
| newFullyQualifiedTypeName: com.fasterxml.jackson.jakarta.rs.json.JacksonJsonProvider |
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.
Thanks a lot for this proposed fix; Seeing the lines just above also changing classes from those same packages I wonder if it would make sense to swap out these ChangeType instances for ChangePackage. Any thoughts there? Are there classes in the old packages that we should not convert similarly?
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.
Thanks for the rapid response!
Good question. I did a little bit more digging, and it appears that it may not be feasible to generalize these into ChangePackage. Existing line 1052-1054 is an example (see screenshot as well): the class name has also changed.
btw, let me know if you think it would be helpful to add a few more lines to cover all the classes in the screenshot .
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.
Thanks for the helpful screenshot! We could then still use ChangePackage to handle the cases where the class name hasn't changed, which I've applied just now. With that we're good to merge, thanks!
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.
Thank you!
(and wow, I learned a new trick on writing recipes from you today!)
JaxbAnnotationIntrospector and JacksonJsonProvider in migration
…21.2 to 3.22.0 [skip ci] [//]: # (dependabot-start)⚠️ \*\*Dependabot is rebasing this PR\*\*⚠️ Rebasing might not happen immediately, so don't worry if this takes some time. Note: if you make any changes to this PR yourself, they will take precedence over the rebase. --- [//]: # (dependabot-end) Bumps [org.openrewrite.recipe:rewrite-migrate-java](https://github.com/openrewrite/rewrite-migrate-java) from 3.21.2 to 3.22.0. Release notes *Sourced from [org.openrewrite.recipe:rewrite-migrate-java's releases](https://github.com/openrewrite/rewrite-migrate-java/releases).* > 3.22.0 > ------ > > What's Changed > -------------- > > * Handle `JaxbAnnotationIntrospector` and `JacksonJsonProvider` in migration by [`@CalvinZengyi`](https://github.com/CalvinZengyi) in [openrewrite/rewrite-migrate-java#936](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/936) > * Also change Gradle classifier for Apache Shiro by [`@timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#939](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/939) > * Remove dependency version upgrade for commons-fileupload by [`@hendrikebbers`](https://github.com/hendrikebbers) in [openrewrite/rewrite-migrate-java#943](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/943) > * Convert `Iterables.all(Collection, Predictate)` into `.stream().allMatch(Predicate)` by [`@timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#945](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/945) > * Wrapping the adding of the dependency for `org.projectlombok:lombok-mapstruct-binding` in a check to make sure you do not already have said dependency (potentially in another scope) by [`@steve-aom-elliott`](https://github.com/steve-aom-elliott) in [openrewrite/rewrite-migrate-java#944](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/944) > * Update jakarta-ee-10.yml by [`@ChenyuWang98`](https://github.com/ChenyuWang98) in [openrewrite/rewrite-migrate-java#946](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/946) > * Use ChangeType for classes renamed in fastjson2 by [`@timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#948](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/948) > > New Contributors > ---------------- > > * [`@CalvinZengyi`](https://github.com/CalvinZengyi) made their first contribution in [openrewrite/rewrite-migrate-java#936](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/936) > * [`@hendrikebbers`](https://github.com/hendrikebbers) made their first contribution in [openrewrite/rewrite-migrate-java#943](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/943) > > **Full Changelog**: <openrewrite/rewrite-migrate-java@v3.21.2...v3.22.0> Commits * [`fadd76b`](openrewrite/rewrite-migrate-java@fadd76b) OpenRewrite recipe best practices * [`0018845`](openrewrite/rewrite-migrate-java@0018845) Use ChangeType for classes renamed in fastjson2 ([#948](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/948)) * [`0208055`](openrewrite/rewrite-migrate-java@0208055) Update jakarta-ee-10.yml ([#946](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/946)) * [`f13464e`](openrewrite/rewrite-migrate-java@f13464e) Wrapping the adding of the dependency for `org.projectlombok:lombok-mapstruct... * [`a272a5a`](openrewrite/rewrite-migrate-java@a272a5a) Update documentation examples * [`7112826`](openrewrite/rewrite-migrate-java@7112826) [Auto] SDKMAN! Java candidates as of 2025-11-17T1017 * [`b17a592`](openrewrite/rewrite-migrate-java@b17a592) Convert `Iterables.all(Collection, Predictate)` into `.stream().allMatch(Pred... * [`c47788e`](openrewrite/rewrite-migrate-java@c47788e) Add `AnnotateRequiredParameters` to `JSpecifyBestPractices` * [`43d728a`](openrewrite/rewrite-migrate-java@43d728a) Remove dependency version upgrade for commons-fileupload ([#943](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/943)) * [`5c0539e`](openrewrite/rewrite-migrate-java@5c0539e) Also change Gradle classifier for Apache Shiro ([#939](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/939)) * Additional commits viewable in [compare view](openrewrite/rewrite-migrate-java@v3.21.2...v3.22.0) [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
What's changed?
Added two more type changes dealing with JakartaEE 9 migration:
com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector->com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationIntrospectorcom.fasterxml.jackson.jaxrs.json.JacksonJsonProvider->com.fasterxml.jackson.jakarta.rs.json.JacksonJsonProviderWhat's your motivation?
These two classes are impacted by Jakarta namespace migration (reference from stackoverflow)
I have been doing so in my local recipe, and I thought it would be helpful to upstream them to OpenRewrite.
Anything in particular you'd like reviewers to focus on?
Anyone you would like to review specifically?
Have you considered any alternatives or workarounds?
Yes. I have had them in my local recipe as an enhancement on top of the JakartaEE migration recipe
Any additional context
Checklist