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

Fix RuntimeHintsPredicates matching rules for public/declared elements #31224

Closed
bclozel opened this issue Sep 13, 2023 · 0 comments
Closed

Fix RuntimeHintsPredicates matching rules for public/declared elements #31224

bclozel opened this issue Sep 13, 2023 · 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 13, 2023

While reviewing missing reachability hints for #31213, I have discussed the reflect-config.json schema and the meaning of its attributes with the GraalVM team. For this issue, we must ensure that our testing infrastructure (hints predicates and the java agent) truly align with the runtime behavior of GraalVM and how is it going to be enforced in the near future.

It turns out that a couple of our assumptions were wrong.

In general, we assume that registering an invocation hint for a field, method or constructor covers also the introspection case. This means that registering "allDeclaredMethods" (invoking all declared methods) infers "queryAllDeclaredMethods" (introspecting all declared methods) and there is no need to register the latter. This part is well aligned with the runtime reflection behavior.

On the other hand, so far we assumed that registering a "declared" hint also covered the "public" variant: for example, our current implementation assumes that registering "allDeclaredMethods" infers "allPublicMethods". This behavior is not consistent for fields, methods and constructors:

  • for constructors "allDeclaredConstructors" infers "allPublicConstructors" as getConstructors() will return a subset of getDeclaredConstructors(). This behavior is not yet fully reflected in the current GraalVM dev build (wrt logged warnings) but should be soon
  • for fields "allDeclaredFields" does not infer "allPublicFields" as getFields() does not return a subset of getDeclaredFields(), as getFields() includes inherited fields but getDeclaredFields() does not.
  • same applies to methods, "allDeclaredMethods" does not infer "allPublicMethods" as getMethods() does not return a subset of getDeclaredMethods(), as getMethods() includes inherited methods but getDeclaredMethods() does not.

Because of this behavior difference for inherited fields and methods, our reflection hints predicates must be aligned with the expected behavior.

@bclozel bclozel added type: bug A general bug theme: aot An issue related to Ahead-of-time processing labels Sep 13, 2023
@bclozel bclozel added this to the 6.0.13 milestone Sep 13, 2023
@bclozel bclozel self-assigned this Sep 13, 2023
@jhoeller jhoeller added the in: core Issues in core modules (aop, beans, core, context, expression) label Sep 14, 2023
essobedo added a commit to apache/camel-spring-boot that referenced this issue Oct 23, 2023
…984)

## Motivation

Since Spring 6.0.13 and the fix for spring-projects/spring-framework#31224, the member category `INVOKE_DECLARED_METHODS` no longer includes public methods so the code needs to be adapted to this behavior change.

## Modifications:

* Register also the member category `INVOKE_PUBLIC_METHODS` when `INVOKE_DECLARED_METHODS` is registered
johnpoth pushed a commit to jboss-fuse/camel-spring-boot that referenced this issue Oct 23, 2023
…pache#984)

## Motivation

Since Spring 6.0.13 and the fix for spring-projects/spring-framework#31224, the member category `INVOKE_DECLARED_METHODS` no longer includes public methods so the code needs to be adapted to this behavior change.

## Modifications:

* Register also the member category `INVOKE_PUBLIC_METHODS` when `INVOKE_DECLARED_METHODS` is registered

(cherry picked from commit ba22da8)
essobedo added a commit to apache/camel-spring-boot that referenced this issue Oct 23, 2023
…985)

## Motivation

Since Spring 6.0.13 and the fix for spring-projects/spring-framework#31224, the member category `INVOKE_DECLARED_METHODS` no longer includes public methods so the code needs to be adapted to this behavior change.

## Modifications:

* Register also the member category `INVOKE_PUBLIC_METHODS` when `INVOKE_DECLARED_METHODS` is registered
cunningt pushed a commit to jboss-fuse/camel-spring-boot that referenced this issue Nov 27, 2023
…pache#984) (#291)

## Motivation

Since Spring 6.0.13 and the fix for spring-projects/spring-framework#31224, the member category `INVOKE_DECLARED_METHODS` no longer includes public methods so the code needs to be adapted to this behavior change.

## Modifications:

* Register also the member category `INVOKE_PUBLIC_METHODS` when `INVOKE_DECLARED_METHODS` is registered

(cherry picked from commit ba22da8)

Co-authored-by: Nicolas Filotto <essobedo@users.noreply.github.com>
Croway pushed a commit to apache/camel-spring-boot that referenced this issue Jan 25, 2024
…984) (#291)

## Motivation

Since Spring 6.0.13 and the fix for spring-projects/spring-framework#31224, the member category `INVOKE_DECLARED_METHODS` no longer includes public methods so the code needs to be adapted to this behavior change.

## Modifications:

* Register also the member category `INVOKE_PUBLIC_METHODS` when `INVOKE_DECLARED_METHODS` is registered

(cherry picked from commit ba22da8)

Co-authored-by: Nicolas Filotto <essobedo@users.noreply.github.com>
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

2 participants