Skip to content

Conversation

@graalvmbot
Copy link

@graalvmbot graalvmbot commented Nov 5, 2025

This PR adds caching in Annotated objects for the result of parsing the raw class file annotation bytes. This allows Graal to directly store AnnotationValues directly in JVMCI objects, removing the need for external caches which can be problematic.

This PR only adds a cache for "declared annotations" which mirrors the caching done by the JDK itself in these fields:

  • java.lang.Class#annotationData.declaredAnnotations
  • java.lang.reflect.Field#declaredAnnotations
  • java.lang.reflect.Executable#declaredAnnotations

I don't see a need for mirroring java.lang.Class#annotationData.annotations as neither Graal nor Native Image make use of Inherited annotations.

This PR also removes the default implementation of Annotated.getTypeAnnotationInfo() so that all Annotated implementors are required to think about how to implement this which avoids subtle bugs due to incomplete or "placeholder" implementations.

Graal PR: oracle/graal#12489

… removed default implementations from all Annotated methods
@graalvmbot graalvmbot merged commit 8b8ae7b into jdk25 Nov 7, 2025
106 of 108 checks passed
@graalvmbot graalvmbot deleted the ds/GR-71140 branch November 7, 2025 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants