[GR-71140] Added caching to Annotated.getDeclaredAnnotationInfo #15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds caching in
Annotatedobjects for the result of parsing the raw class file annotation bytes. This allows Graal to directly storeAnnotationValuesdirectly 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.declaredAnnotationsjava.lang.reflect.Field#declaredAnnotationsjava.lang.reflect.Executable#declaredAnnotationsI don't see a need for mirroring
java.lang.Class#annotationData.annotationsas neither Graal nor Native Image make use ofInheritedannotations.This PR also removes the default implementation of
Annotated.getTypeAnnotationInfo()so that allAnnotatedimplementors are required to think about how to implement this which avoids subtle bugs due to incomplete or "placeholder" implementations.Graal PR: oracle/graal#12489