Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align RuntimeHintsAgent behavior with GraalVM reflection changes #29205

Closed
bclozel opened this issue Sep 26, 2022 · 0 comments
Closed

Align RuntimeHintsAgent behavior with GraalVM reflection changes #29205

bclozel opened this issue Sep 26, 2022 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Sep 26, 2022

We should revisit what's been done in #29091 since GraalVM is likely to change behavior and align better with the JVM.

The GraalVM native image should throw exceptions underlining when reachability metadata is missing, and improving the general behavior to ensure that reachability metadata are composable and don't break code when more hints are added.

For #29091, this means that the following would be made required at runtime:

  • calling Class.getMethods() requires "queryAllPublicMethods" : true
  • calling Class.getDeclaredMethods() requires "queryAllDeclaredMethods" : true
  • same for fields, constructors and inner classes

This issue is about aligning the RuntimeHintsAgent with those changes.

This issue is currently on hold, until the behavior change is merged in GraalVM. See the proposal.

@bclozel bclozel added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing labels Sep 26, 2022
@bclozel bclozel added this to the 6.0.x milestone Sep 26, 2022
@bclozel bclozel self-assigned this Sep 26, 2022
@bclozel bclozel modified the milestones: 6.0.x, 6.0.0-RC1 Sep 27, 2022
@bclozel bclozel closed this as completed in 43d39d4 Oct 3, 2022
bclozel added a commit that referenced this issue Oct 3, 2022
As a follow up of #29205, we now need to contribute an "introspection on
declared method" reflection hint for all registered beans.

Closes gh-29246
bclozel added a commit that referenced this issue Mar 29, 2023
Prior to this commit, reflection hints registered for beans was
selectively applied to only consider the methods that we'll actually
need reflection on at runtime. This would rely on an undocumented
behavior of GraalVM Native where calling `getDeclaredMethods` on a type
would only return known metadata at runtime, ignoring the ones that were
not registered during native compilation.

As of oracle/graal#5171, this behavior is now fixed in GraalVM and
aligns with the JVM behavior: all methods will be returned. This means
that if during native compilation, introspection was not registered for
the type a new `MissingReflectionMetadataException` will be raised.

As a follow up of #29205, this commit contributes the "introspection on
declared method" reflection hint for all registered beans.

Closes gh-29246
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant