Skip to content

Tag: java-17

Why RecordComponent doesn’t have annotation info that is defined in the Records class in Java 17?

I play with records and found something that doesn’t look logical to me: Record: Code: However, if I do: Is that expected? Because RecordComponent implements AnnotatedElement, so I thought RecordComponent should have info about annotations. Are my expectations wrong? Answer This depends on the specified permitted targets of the annotation. The record component has an associated constructor parameter, field, accessor