-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add migration rewrite for non-named arguments in Java annotations (#2…
…1397) Followup to #21329 It might be beneficial for Scala 3.6 migration to allow for an automatic rewrite of unnamed Java annotation parameters to ease the migration. We can assume that already compiling code is already using correct positions for annotation arguments. Based on that, we can use the order of the annotation decls and their indexes to assume the names of annotation arguments
- Loading branch information
Showing
9 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
8 changes: 8 additions & 0 deletions
8
tests/rewrites/annotation-named-pararamters/MyAnnotation.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import java.util.concurrent.TimeUnit; | ||
|
||
public @interface MyAnnotation { | ||
public TimeUnit D() default TimeUnit.DAYS; | ||
TimeUnit C() default TimeUnit.DAYS; | ||
String A() default ""; | ||
public String B() default ""; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import java.util.concurrent.TimeUnit | ||
@MyAnnotation() class Test1 | ||
@MyAnnotation(D = TimeUnit.DAYS) class Test2 | ||
@MyAnnotation(D = TimeUnit.DAYS, C = TimeUnit.DAYS) class Test3 | ||
@MyAnnotation(D = TimeUnit.DAYS, C = TimeUnit.DAYS, A = "foo") class Test4 | ||
@MyAnnotation(D = TimeUnit.DAYS, C = TimeUnit.DAYS, A = "foo", B = "bar") class Test5 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import java.util.concurrent.TimeUnit | ||
@MyAnnotation() class Test1 | ||
@MyAnnotation(TimeUnit.DAYS) class Test2 | ||
@MyAnnotation(TimeUnit.DAYS, TimeUnit.DAYS) class Test3 | ||
@MyAnnotation(TimeUnit.DAYS, TimeUnit.DAYS, "foo") class Test4 | ||
@MyAnnotation(TimeUnit.DAYS, TimeUnit.DAYS, "foo", "bar") class Test5 |