Make subpackage recursion explicit in the Jackson JAX-RS JSON rename - #1185
Merged
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
com.fasterxml.jackson.jaxrs.json→com.fasterxml.jackson.jakarta.rs.jsoninjakarta-ee-9.ymlomitsrecursivewhile depending on it, so types in the.annotationsubpackage 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.annotationcom.fasterxml.jackson.jakarta.rs.json.annotationThe 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.fastjson→com.alibaba.fastjson2(only.annotationhas a counterpart; fastjson2 has no.parser/.serializer/.support.*), andcom.sun.net.ssl→javax.net.ssl(no.internalcounterpart).Why the tests didn't catch this
ChangePackage.recursiveis@Nullablewithrequired = falseand 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 inoldPackageName— which every existing fixture happens to do. A real source file importing only the subpackage type was never migrated.recursiveconsistently mean non-recursive inChangePackagerewrite#8382 settles null as non-recursive, which is what surfaced it; I found this while auditing declarativeChangePackageusages against the published artifacts.Verification
./gradlew testgreen. Each new test fails without therecursive: trueline and passes with it. Correct on its own merits and safe to merge now, independently of rewrite#8382.