Skip to content

Conversation

@graalvmbot
Copy link
Collaborator

As a pre-requisite of GR-69713, this PR replaces usages of AnnotatedElement methods in SVM where the receiver is a JVMCI type with methods in the new com.oracle.svm.util.AnnotationUtil class which is like AnnotationAccess but is for use by SVM internal code. It avoids relying on JVMCI types (such as ResolvedJavaType) implementing java.lang.reflect.AnnotatedElement. This inheritance is planned for removal (GR-69713).

These changes were assisted by IntelliJ's support for structural replacement (Edit -> Find -> Replace Structurally...).


Automated PR Summary

This PR is a preparatory refactor to decouple annotation access in SVM and replace usages of java.lang.reflect.AnnotatedElement with a new approach using AnnotationValueSupport and a utility interface AnnotationUtil.Access. The change avoids relying on JVMCI types such as ResolvedJavaType implementing AnnotatedElement, supporting the planned removal of this inheritance (as part of GR-69713). In addition, the PR updates and extends SVM annotation-related utilities as well as refactors several internal and testing classes throughout SVM and Espresso to use the new approach. This enables removing a tight coupling with Java reflection and lays the foundation for future refactorings.

Key Changes:

  • Implements a new com.oracle.svm.util.AnnotationUtil utility class for annotation access, providing access to annotation values without requiring JVMCI types to implement AnnotatedElement.
  • Updates usages in SVM, Native Image, and Espresso (e.g., Meta, Field, Klass, ParserMethod, HostedMethod, several Feature and Substitution classes, and infrastructure utilities) to leverage AnnotationUtil over raw reflection.
  • Refactors and extends the SVM annotation extraction system to expose methods compatible with the new interface.
  • Moves dependency on AnnotationAccess for annotation checks to the new utility across the codebase.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 25, 2025
@graalvmbot graalvmbot force-pushed the ds/GR-70940 branch 4 times, most recently from 4ebb24a to 17169e4 Compare October 26, 2025 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants