Make subpackage recursion explicit in the Micronaut LDAP rename - #144
Merged
Conversation
`io.micronaut.configuration.security.ldap` -> `io.micronaut.security.ldap`
omits `recursive` while depending on it, so types in its subpackages were
never migrated.
Verified against the published artifacts:
micronaut-security-ldap 1.4.0 -> 4.13.0
io.micronaut.configuration.security.ldap.configuration -> io.micronaut.security.ldap.configuration
io.micronaut.configuration.security.ldap.context -> io.micronaut.security.ldap.context
io.micronaut.configuration.security.ldap.group -> io.micronaut.security.ldap.group
All three map exactly under prefix substitution, so recursion is both safe
and required here. The sibling `io.micronaut.configuration.cassandra` rule is
left alone: that package has no subpackages in micronaut-cassandra 1.2.0.
This had no test coverage at all. `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 covers both the direct and the subpackage type;
the subpackage case 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.
io.micronaut.configuration.security.ldap→io.micronaut.security.ldapinmicronaut2-to-3.ymlomitsrecursivewhile depending on it, so types in its subpackages were never migrated.Verified against the published artifacts — micronaut-security-ldap 1.4.0 → 4.13.0:
io.micronaut.configuration.security.ldap.configurationio.micronaut.security.ldap.configurationio.micronaut.configuration.security.ldap.contextio.micronaut.security.ldap.contextio.micronaut.configuration.security.ldap.groupio.micronaut.security.ldap.groupAll three map exactly under prefix substitution, so recursion is both safe and required here.
The sibling
io.micronaut.configuration.cassandra→io.micronaut.cassandrarule is deliberately left alone: that package has no subpackages in micronaut-cassandra 1.2.0. (Theio.micronaut.cassandra.healthpackage in current versions was added later, so it isn't a migration concern.)These renames had no test coverage at all, so the new
Micronaut2to3PackageMigrationTestcovers both the direct type and the subpackage type.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.