Spring Boot 2.0 - moving the precondition to run in more cases #555
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.
What's changed?
narrowing the precondition on the SB 2.0 recipe to ensure it runs more consistently.
What's your motivation?
https://github.com/openrewrite/rewrite-spring/pull/543/files#r1678212731
Anything in particular you'd like reviewers to focus on?
the new precondition is better, but does have a false positive if running the 2.2 recipe on a 2.2 project and a false negative if running the 2.7 recipe on a 2.7 project. this is hard to avoid. the javax.validation-api dep is necessary for SB 2.3 (when hibernate-validator 6.1 swaps its transitive dep from javax to jakarta) through SB 2.7 until SB 3.0 (when spring swaps to jakarta). and with this recipe's placement, it has to make an educated guess about the "final" version of SB for the project after all other recipes in the chain complete while only knowing the current version.
Anyone you would like to review specifically?
@BoykoAlex
Have you considered any alternatives or workarounds?
a nice counterbalance to this recipe might be if the
rewrite-migrate-java
javax->jakarta migration removed direct jakarta deps which are also available transitively, after it converts javax deps to jakarta. this would help untangle a pom which previously usedspring-boot-starter-validation
plusjavax.validation-api
. in the current state, the javax->jakarta recipe leaves such a pom with a redundantjakarta.validation-api
which the starter already has covered.Any additional context
Checklist