The Jakarta annotation migration adds jakarta.annotation-api for imports the parser could not resolve - #1265
Merged
jkschneider merged 1 commit intoOct 4, 2026
Conversation
jkschneider
force-pushed
the
jakarta/annotation-api-for-imports
branch
from
October 3, 2026 22:26
621cf89 to
ab6da14
Compare
jkschneider
added this pull request to stack #1284
October 4, 2026 09:43
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.
Java 8 also ships
javax.annotation.Resourceand the other Common Annotations, so Java 8 LSTs leave them unresolved too, andJavaxAnnotationMigrationToJakartaAnnotationmoved@Resourcetojakarta.annotation.Resourcewithout addingjakarta.annotation-api. It now runsAddApiDependencyForImports, the #1257 recipe as generalized in the previous pull request, forjakarta.annotationand 2.0.x. Imports fromjavax.annotation.processing, which is still in the JDK, andjavax.annotation.concurrent, which comes from JSR-305, do not count, the same packages the migration's non-recursiveChangePackagealready leaves alone.Found by a team of coding agents reviewing a Moderne run of
org.openrewrite.java.migrate.jakarta.JavaxMigrationToJakartaover the 31 Arquillian repositories (run 20261003120559-YQoma). The issue isannotation-api-missing-java8in the run'sio.moderne.RecipeIssuesdata table (1 row), and the fix was discussed and reviewed on the run's message board. A row from the table, as a generalized example:Java 8 Resource annotations are migrated without adding their Jakarta API. (
arquillian/arquillian-rusheye,rusheye-api/pom.xml, recipeorg.openrewrite.java.migrate.jakarta.JavaxMigrationToJakarta)Before:
What the recipe produced:
Expected:
Stacked on #1264 (2 of 19); merge that one first.