Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ public Tree preVisit(Tree tree, ExecutionContext ctx) {
J.CompilationUnit cu = (J.CompilationUnit) tree;
for (J.Import anImport : cu.getImports()) {
String typeName = anImport.getTypeName();
if (typeName.startsWith(packageName + ".") || typeName.startsWith(javaxPackage + ".")) {
if ((typeName.startsWith(packageName + ".") || typeName.startsWith(javaxPackage + ".")) &&
// Still in the JDK (processing) or from JSR-305 (concurrent), not the Annotations API
!typeName.startsWith("javax.annotation.processing.") &&
!typeName.startsWith("javax.annotation.concurrent.")) {
acc.sources.add(cu.getSourcePath());
break;
}
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/META-INF/rewrite/jakarta-ee-9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ recipeList:
version: 2.0.x
onlyIfUsing: javax.annotation..*
acceptTransitive: true
- org.openrewrite.java.migrate.javax.AddApiDependencyForImports:
packageName: jakarta.annotation
groupId: jakarta.annotation
artifactId: jakarta.annotation-api
version: 2.0.x
- org.openrewrite.java.ChangePackage:
oldPackageName: javax.annotation
newPackageName: jakarta.annotation
Expand Down
Loading
Loading