JDK-8323094 : Release Note: `TypeMirror` Changed to Provide Annotations for Types Loaded from Bytecode
  • Type: Sub-task
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 22
  • Priority: P4
  • Status: Resolved
  • Resolution: Delivered
  • Submitted: 2024-01-05
  • Updated: 2024-02-16
  • Resolved: 2024-01-26
Description
The implementation of `TypeMirror` now provides access to annotations for types loaded from bytecode. Previously type annotations were not associated with types loaded from bytecode.

Annotation processors can access type annotations for elements using `AnnotationMirror#getAnnotationMirrors`, and the annotations will be included in the output of `AnnotationMirror#toString`.

Any programs that relied on annotations being omitted for elements loaded from the classpath should be updated to handle type annotations.