Skip to content

Conversation

graalvmbot
Copy link
Collaborator

Fields annotated with @InjectAccessors should never be in the image heap.

However, the ReflectionPlugins can constant fold calls to getDeclaredField, even if the field is annotated as such.

Those fields are already silently not registered for reflection because of SubstitutionReflectivityFilter#shouldExclude.

This PR refactors SubstitutionReflectivityFilter into a Feature and reuses it to ensure all AnnotatedElements that should be excluded from the image are not constant folded.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Sep 17, 2025
@graalvmbot graalvmbot merged commit adf4cac into master Sep 17, 2025
13 checks passed
@graalvmbot graalvmbot deleted the scoppey/GR-69604/prevent-constant-folding-inject-accessors branch September 17, 2025 23:08
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