-
Bug
-
Resolution: Fixed
-
P3
-
None
-
b08
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8281392 | 11.0.16-oracle | Vicente Arturo Romero Zaldivar | P3 | Resolved | Fixed | b01 |
JDK-8280630 | 11.0.15 | Liam Miller-Cushon | P3 | Resolved | Fixed | b01 |
For this test case:
import java.lang.annotation.*;
@Target({ElementType.TYPE_USE, ElementType.RECORD_COMPONENT})
@Retention(RetentionPolicy.RUNTIME)
@interface Anno { }
record R(@Anno String s) {}
javac decorates the corresponding field with two instances of @Anno, when it should have only one, a type annotation applied to the type of the field. From the class file:
private final java.lang.String s;
descriptor: Ljava/lang/String;
flags: (0x0012) ACC_PRIVATE, ACC_FINAL
RuntimeVisibleAnnotations:
0: #27()
Anno
RuntimeVisibleTypeAnnotations:
0: #27(): FIELD
Anno
From a test case created by: Dmitry Bessonov
import java.lang.annotation.*;
@Target({ElementType.TYPE_USE, ElementType.RECORD_COMPONENT})
@Retention(RetentionPolicy.RUNTIME)
@interface Anno { }
record R(@Anno String s) {}
javac decorates the corresponding field with two instances of @Anno, when it should have only one, a type annotation applied to the type of the field. From the class file:
private final java.lang.String s;
descriptor: Ljava/lang/String;
flags: (0x0012) ACC_PRIVATE, ACC_FINAL
RuntimeVisibleAnnotations:
0: #27()
Anno
RuntimeVisibleTypeAnnotations:
0: #27(): FIELD
Anno
From a test case created by: Dmitry Bessonov
- backported by
-
JDK-8280630 javac generates wrong annotation for fields generated from record components
-
- Resolved
-
-
JDK-8281392 javac generates wrong annotation for fields generated from record components
-
- Resolved
-
- relates to
-
JDK-8239447 compiler error for annotations applied to record components with target METHOD
-
- Closed
-
-
JDK-8261205 AssertionError: Cannot add metadata to an intersection type
-
- Resolved
-
(1 links to)