|
| 1 | +-- [E201] Syntax Error: tests/neg/i20554-a/Test.scala:3:12 ------------------------------------------------------------- |
| 2 | +3 |@Annotation(3, 4) // error // error : Java defined annotation should be called with named arguments |
| 3 | + | ^ |
| 4 | + | Named arguments are required for Java defined annotations |
| 5 | + |--------------------------------------------------------------------------------------------------------------------- |
| 6 | + | Explanation (enabled by `-explain`) |
| 7 | + |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 8 | + | Starting from Scala 3.6.0, named arguments are required for Java defined annotations. |
| 9 | + | Java defined annotations don't have an exact constructor representation |
| 10 | + | and we previously relied on the order of the fields to create one. |
| 11 | + | One possible issue with this representation is the reordering of the fields. |
| 12 | + | Lets take the following example: |
| 13 | + | |
| 14 | + | public @interface Annotation { |
| 15 | + | int a() default 41; |
| 16 | + | int b() default 42; |
| 17 | + | } |
| 18 | + | |
| 19 | + | Reordering the fields is binary-compatible but it might affect the meaning of @Annotation(1) |
| 20 | + | |
| 21 | + --------------------------------------------------------------------------------------------------------------------- |
| 22 | +-- [E201] Syntax Error: tests/neg/i20554-a/Test.scala:3:15 ------------------------------------------------------------- |
| 23 | +3 |@Annotation(3, 4) // error // error : Java defined annotation should be called with named arguments |
| 24 | + | ^ |
| 25 | + | Named arguments are required for Java defined annotations |
| 26 | + |--------------------------------------------------------------------------------------------------------------------- |
| 27 | + | Explanation (enabled by `-explain`) |
| 28 | + |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 29 | + | Starting from Scala 3.6.0, named arguments are required for Java defined annotations. |
| 30 | + | Java defined annotations don't have an exact constructor representation |
| 31 | + | and we previously relied on the order of the fields to create one. |
| 32 | + | One possible issue with this representation is the reordering of the fields. |
| 33 | + | Lets take the following example: |
| 34 | + | |
| 35 | + | public @interface Annotation { |
| 36 | + | int a() default 41; |
| 37 | + | int b() default 42; |
| 38 | + | } |
| 39 | + | |
| 40 | + | Reordering the fields is binary-compatible but it might affect the meaning of @Annotation(1) |
| 41 | + | |
| 42 | + --------------------------------------------------------------------------------------------------------------------- |
0 commit comments