rewrite-migrate-java icon indicating copy to clipboard operation
rewrite-migrate-java copied to clipboard

Running ``org.openrewrite.java.migrate.UpgradeToJava21` should not downgrade `jakarta.inject-api` dependency, should it?

Open koppor opened this issue 1 year ago • 3 comments

I ran org.openrewrite.java.migrate.UpgradeToJava21 in moderne.io (https://app.moderne.io/results/gIKdjKpB8)

I scrolled through diff, I found a change inside build.gradle:

-   implementation 'jakarta.inject:jakarta.inject-api:2.0.1'
+   implementation 'jakarta.inject:jakarta.inject-api:1.0.3'

I think, this should not happen, should it?


Side question: Where can I post the wish that moderne should offer a tree like the GitHub file diff (or Octotree)? I really like the UX of GitHub's tree, so that I can quickly see which fles were changed. For large diffs, this is very helpflul.

koppor avatar Jan 14 '24 11:01 koppor

Where can I post the wish that moderne should offer a tree like the GitHub file diff (or Octotree)? I really like the UX of GitHub's tree, so that I can quickly see which files were changed. For large diffs, this is very helpfull.

Passed on to the team, thanks!

I scrolled through diff, I found a change inside build.gradle

Indeed we ought not to downgrade that dependency; it looks like we might be doing so here https://github.com/openrewrite/rewrite-migrate-java/blob/848d01381b674b83aee5f7cc67f3076864aea476/src/main/resources/META-INF/rewrite/add-inject-dependencies.yml#L28-L40

timtebeek avatar Jan 15 '24 21:01 timtebeek

We also have these dependencies changed in the recipes here https://github.com/openrewrite/rewrite-migrate-java/blob/848d01381b674b83aee5f7cc67f3076864aea476/src/main/resources/META-INF/rewrite/jakarta-ee-9.yml#L439-L448

timtebeek avatar Jan 15 '24 21:01 timtebeek

It looks like this is the hierarchy through which the dependency is updated from Java 21: https://app.moderne.io/recipes/org.openrewrite.java.migrate.javax.AddInjectDependencies https://app.moderne.io/recipes/org.openrewrite.java.migrate.Java8toJava11 https://app.moderne.io/recipes/org.openrewrite.java.migrate.UpgradeToJava17 https://app.moderne.io/recipes/org.openrewrite.java.migrate.UpgradeToJava21

It looks like jakarta-ee-9 is not run as part of a Java 21 upgrade: https://app.moderne.io/recipes/org.openrewrite.java.migrate.jakarta.JavaxMigrationToJakarta https://app.moderne.io/recipes/org.openrewrite.java.migrate.jakarta.JavaxInjectMigrationToJakartaInject

timtebeek avatar Jan 15 '24 21:01 timtebeek