Skip to content

[GR-48191] Enable lambda reflection queries #11350

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

graalvmbot
Copy link
Collaborator

Enables reachability metadata JSON files to register reflective queries on lambda classes. A lambda class is defined according to the following parameters:

  • A class within which it is declared;
  • Optionally, a method within which it is declared;
  • A list of interfaces it implements.

Resolving a lambda can therefore yield multiple classes. This PR includes the necessary changes to the parsing code.

JSON format
The following format is used to specify a lambda class in a reachability-metadata.json file:

{
    "type": {
        "lambda": {
            "declaringClass": "fully.qualified.ClassName",
            "declaringMethod": {
                "name": "methodName",
                "parameterTypes": [
                    "fully.qualified.ParameterType"
                ]
            },
            "interfaces": [
                "java.lang.Runnable"
            ]
        }
    }
}

The "declaringMethod" field is optional. When it is missing, lambda classes will be searched within every method declared in the specified class.

Agent behavior
The Native Image agent now supports lambda classes like regular classes and proxies. It never emits the "declaringMethod" field, as it is not possible to recover this information at run-time from a Class object. Trace files now encode types in the same way as ConfigurationTypeDescriptor, which makes them more flexible and easier to parse.

Backwards compatibility
This change will be backported to all GraalVM LTS versions to enable them to read files containing lambda definitions created by GraalVM 25.0 and higher.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jun 5, 2025
@graalvmbot graalvmbot force-pushed the lottet/GR-48191-lambda-json branch 2 times, most recently from f774611 to f1c3a80 Compare June 11, 2025 14:32
@graalvmbot graalvmbot force-pushed the lottet/GR-48191-lambda-json branch from f1c3a80 to d47616e Compare June 11, 2025 15:42
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