Skip to content

Make subpackage recursion explicit in the Jackson JAX-RS JSON rename - #1185

Merged
timtebeek merged 1 commit into
mainfrom
tim/changepackage-recursive-subpackages
Aug 5, 2026
Merged

Make subpackage recursion explicit in the Jackson JAX-RS JSON rename#1185
timtebeek merged 1 commit into
mainfrom
tim/changepackage-recursive-subpackages

Conversation

@timtebeek

@timtebeek timtebeek commented Aug 5, 2026

Copy link
Copy Markdown
Member

com.fasterxml.jackson.jaxrs.jsoncom.fasterxml.jackson.jakarta.rs.json in jakarta-ee-9.yml omits recursive while depending on it, so types in the .annotation subpackage were never migrated.

Verified against the published artifacts — jackson-jaxrs-json-provider 2.14.3 → jackson-jakarta-rs-json-provider 2.15.4:

old new
com.fasterxml.jackson.jaxrs.json.annotation com.fasterxml.jackson.jakarta.rs.json.annotation

The subpackage maps exactly under prefix substitution, so recursion is both safe and required here.

I audited the other 18 recursive-omitting rules in this repo the same way (the DataNucleus set, org.apache.shiro.codec, javax.annotation.security / .sql, javax.security.cert, org.apache.commons.fileupload2.jakarta.servlet5, …) and they are all leaf packages, so this is the only one that needs changing. Two are deliberately left non-recursive because recursion would be wrong: com.alibaba.fastjsoncom.alibaba.fastjson2 (only .annotation has a counterpart; fastjson2 has no .parser / .serializer / .support.*), and com.sun.net.ssljavax.net.ssl (no .internal counterpart).

Why the tests didn't catch this

ChangePackage.recursive is @Nullable with required = false and no documented default, and a null was read two different ways inside the same recipe: non-recursive by its preconditions, recursive by its visitor. The upshot is that a subpackage type gets renamed only if the file also references a type sitting directly in oldPackageName — which every existing fixture happens to do. A real source file importing only the subpackage type was never migrated.

Verification

  • Full ./gradlew test green. Each new test fails without the recursive: true line and passes with it. Correct on its own merits and safe to merge now, independently of rewrite#8382.

`com.fasterxml.jackson.jaxrs.json` -> `com.fasterxml.jackson.jakarta.rs.json`
omits `recursive` while depending on it, so types in the `.annotation`
subpackage were never migrated.

Verified against the published artifacts:

    jackson-jaxrs-json-provider 2.14.3       -> jackson-jakarta-rs-json-provider 2.15.4
      com.fasterxml.jackson.jaxrs.json.annotation -> com.fasterxml.jackson.jakarta.rs.json.annotation

The subpackage maps exactly under prefix substitution, so recursion is both
safe and required here.

The existing tests could not catch this. `ChangePackage.recursive` is
`@Nullable` with no documented default, and a null was read as non-recursive
by the recipe's preconditions but as recursive by its visitor, so a subpackage
type was renamed only for files that also referenced a type sitting directly
in `oldPackageName`. The new test imports only `...jaxrs.json.annotation.JSONP`
and fails without this change.
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Aug 5, 2026
@timtebeek
timtebeek merged commit 55f2e93 into main Aug 5, 2026
1 check passed
@timtebeek
timtebeek deleted the tim/changepackage-recursive-subpackages branch August 5, 2026 09:11
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Aug 5, 2026
mergify Bot added a commit to robfrank/linklift that referenced this pull request Aug 20, 2026
…41.0 to 3.42.0 [skip ci]

Bumps [org.openrewrite.recipe:rewrite-migrate-java](https://github.com/openrewrite/rewrite-migrate-java) from 3.41.0 to 3.42.0.
Release notes

*Sourced from [org.openrewrite.recipe:rewrite-migrate-java's releases](https://github.com/openrewrite/rewrite-migrate-java/releases).*

> 3.42.0
> ------
>
> What's Changed
> --------------
>
> * Adopt upstream XML trailing-comment formatting by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#1180](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1180)
> * Add mapping for CheckForNull to JSpecify annotation by [`@​zbynek`](https://github.com/zbynek) in [openrewrite/rewrite-migrate-java#1179](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1179)
> * Skip `UseSetOf`/`UseListOf` for `HashSet`/`ArrayList` subclasses by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#1182](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1182)
> * Avoid hardcoded patch version in UpdateSdkManTest by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#1183](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1183)
> * Only add the Mockito surefire agent configuration when asked, and keep it minimal by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#1184](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1184)
> * Make subpackage recursion explicit in the Jackson JAX-RS JSON rename by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#1185](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1185)
> * Add the Mockito agent properties goal in its own execution by [`@​MBoegers`](https://github.com/MBoegers) in [openrewrite/rewrite-migrate-java#1186](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1186)
> * Derive SDKMAN test versions from the candidate list by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#1188](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1188)
> * Do not apply `var` when the generic return type needs the declared type by [`@​jevanlingen`](https://github.com/jevanlingen) in [openrewrite/rewrite-migrate-java#1187](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1187)
> * Cover legacy Bouncy Castle artifacts and their API changes by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#1189](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1189)
> * Add jakarta.validation-api dependency when migrating com.sun.istack.NotNull by [`@​steve-aom-elliott`](https://github.com/steve-aom-elliott) in [openrewrite/rewrite-migrate-java#1190](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1190)
>
> New Contributors
> ----------------
>
> * [`@​zbynek`](https://github.com/zbynek) made their first contribution in [openrewrite/rewrite-migrate-java#1179](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1179)
>
> **Full Changelog**: <openrewrite/rewrite-migrate-java@v3.41.0...v3.42.0>


Commits

* [`1238ceb`](openrewrite/rewrite-migrate-java@1238ceb) OpenRewrite recipe best practices
* [`01d0fe8`](openrewrite/rewrite-migrate-java@01d0fe8) Add `jakarta.validation-api` dependency when migrating `com.sun.istack.NotNul...
* [`33354b5`](openrewrite/rewrite-migrate-java@33354b5) Cover legacy Bouncy Castle artifacts and their API changes ([#1189](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/1189))
* [`6c648a5`](openrewrite/rewrite-migrate-java@6c648a5) Update Gradle wrapper to 9.7.0
* [`7099ad3`](openrewrite/rewrite-migrate-java@7099ad3) Do not apply `var` when the generic return type needs the declared type ([#1187](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/1187))
* [`ccfa7b0`](openrewrite/rewrite-migrate-java@ccfa7b0) Derive SDKMAN test versions from the candidate list ([#1188](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/1188))
* [`96e8647`](openrewrite/rewrite-migrate-java@96e8647) [Auto] SDKMAN! Java candidates as of 2026-08-10T1102
* [`26f898e`](openrewrite/rewrite-migrate-java@26f898e) Add the Mockito agent properties goal in its own execution ([#1186](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/1186))
* [`d82dd47`](openrewrite/rewrite-migrate-java@d82dd47) OpenRewrite recipe best practices
* [`55f2e93`](openrewrite/rewrite-migrate-java@55f2e93) Make subpackage recursion explicit in the Jackson JAX-RS JSON rename ([#1185](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/1185))
* Additional commits viewable in [compare view](openrewrite/rewrite-migrate-java@v3.41.0...v3.42.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant