Annotations on Records and Record Components

Summers Pittman ℝ secondsun at
Tue Jan 28 15:13:41 UTC 2020

I created a record but I can't access the annotations on the record

Given the following record

record Record(@JsonProperty("id") int id, @JsonProperty("text")  String
text){ }

I ran the following code to reflect the annotations

        var recClass = Record.class;
        for (RecordComponent recordComponent :
recClass.getRecordComponents()) {
            System.out.print("RecordComponent : ");
            for (Annotation anno :
recordComponent.getDeclaredAnnotations()) {
                System.out.print("RecordComponent Annotation : ");

and I don't see the annotations listed in the output:

RecordComponent : int id
RecordComponent : java.lang.String text

Am I holding it wrong? I'm using Java 14.ea.33 if the version helps.

Summers Pittman
>>Phone:404 941 4698
>>Java is my crack.

More information about the amber-dev mailing list