[GR-78020] Use generated wrappers when accessing guest annotations - #14318
Merged
graalvmbot merged 8 commits intoAug 26, 2026
Merged
Conversation
Generate a hosted-only get method on each guest annotation value that combines metadata lookup with conversion to the generated record. Retain the from method for consumers that already hold raw annotation metadata, such as declared-only and repeatable lookups.
Replace the ordinary generated-value lookup patterns that predate this migration with the generated get shorthand. Keep raw from conversions only where callers intentionally process declared-only or nested annotation metadata.
Retain injected substitution annotations as AnnotationValue metadata and remove unused constructors that accepted materialized annotations. Remove the now-dead reverse conversion APIs so builder-to-guest annotation flow remains metadata-native.
Replace builder annotation materialization used only for null checks with GuestAnnotationAccess.isAnnotationPresent. This keeps presence queries in metadata form across hosted, compiler, Truffle, interpreter, and Web Image consumers.
Use the existing C entry-point and C-function guest value records instead of materializing builder annotations. Keep class-valued members as ResolvedJavaType metadata and invoke entry-point predicates in the guest context.
Register generated metadata wrappers for the remaining hosted guest annotation consumers. Place each wrapper family in a shared package for its consuming module and enable the processor where needed.
Replace the remaining hosted builder annotation materialization with generated metadata records. Keep class-valued members as guest types where consumers can operate on metadata and preserve narrow host-class conversion boundaries only for legacy callback APIs tracked by GR-78934. Resolve hosted policy types directly through guest metadata, remove obsolete annotation-taking code paths, and retain only the annotation processors required to generate the migrated values.
Replace builder annotation materialization for the four repeatable consumers with a metadata-level lookup that preserves direct-first, container-second ordering. Generate typed wrappers for the repeated leaf annotations and keep class-valued comparisons in the guest context.
graalvmbot
deleted the
d-kozak/GR-78020/migrate-guest-annotation-consumers
branch
August 26, 2026 22:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Champion reviewer: Josef Eisl
Summary
When Native Image runs with an external JVMCI runtime, annotation data belongs to the guest VM. Build-time code previously converted that data into
java.lang.Annotationproxy objects in the builder VM, even when it only needed to check whether an annotation exists or read a few members.This PR removes those unnecessary builder-side proxies:
AnnotationValueor generated typed*GuestValuerecords.AnnotationValueentries and then converted through generated wrappers.AnnotationValueis removed.Commit Structure
The eight commits first introduce generated direct-access helpers and convert preexisting ordinary wrapper lookups. The remaining commits separate removal of the reverse conversion, conversion of presence-only checks, adoption of existing generated records, generation of additional records, migration of member-reading consumers, and migration of repeatable annotations.
Scope
This PR migrates all build-time builder-to-guest annotation consumers, including repeatable annotations and their generated container annotations. Five annotation lookups remain in compiler code shared between image building and the Crema or Ristretto runtime compiler paths; they intentionally retain the runtime-aware API.
Three C-interface configuration callbacks still require builder classes. GR-78934 tracks moving those callbacks into the guest context and removing the remaining class-conversion boundaries.