|
| 1 | +-- [E201] Syntax Error: tests/neg/i20554/Test.scala:3:18 --------------------------------------------------------------- |
| 2 | +3 |@SimpleAnnotation(1) // error |
| 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/Test.scala:4:12 --------------------------------------------------------------- |
| 23 | +4 |@Annotation(3, 4) // error // error |
| 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 | + --------------------------------------------------------------------------------------------------------------------- |
| 43 | +-- [E201] Syntax Error: tests/neg/i20554/Test.scala:4:15 --------------------------------------------------------------- |
| 44 | +4 |@Annotation(3, 4) // error // error |
| 45 | + | ^ |
| 46 | + | Named arguments are required for Java defined annotations |
| 47 | + |--------------------------------------------------------------------------------------------------------------------- |
| 48 | + | Explanation (enabled by `-explain`) |
| 49 | + |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 50 | + | Starting from Scala 3.6.0, named arguments are required for Java defined annotations. |
| 51 | + | Java defined annotations don't have an exact constructor representation |
| 52 | + | and we previously relied on the order of the fields to create one. |
| 53 | + | One possible issue with this representation is the reordering of the fields. |
| 54 | + | Lets take the following example: |
| 55 | + | |
| 56 | + | public @interface Annotation { |
| 57 | + | int a() default 41; |
| 58 | + | int b() default 42; |
| 59 | + | } |
| 60 | + | |
| 61 | + | Reordering the fields is binary-compatible but it might affect the meaning of @Annotation(1) |
| 62 | + | |
| 63 | + --------------------------------------------------------------------------------------------------------------------- |
0 commit comments