-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
Description
TL;DR
Currently, it is impossible to reflectively access elements of lambdas and Proxy classes in Native Image. The reason is that the format of reflect-config.json can not refer to lambda and proxy types. The current JSON element name can't be used as lambdas and proxies don't have a stable class name to refer to.
This proposal would allow reflective access to proxy classes and lambda classes in Native Image by supporting proxies and lambdas in reachability metadata.
Goals
This proposal should add two new types of elements to reflect-config.json and jni-config.json:
- For proxies we propose referring to them via the list of interfaces in the following way:
{
"proxy": ["interface1", "interface2"],
"queryAllDeclaredFields": true
}- For lambdas, we propose referring to the lambda via the capturing class of a lambda and the list of types that the lambda implements:
{
"lambda": {
"capturingClass": "Foo",
"inheritedTypes": [ "java.lang.Runnable" ]
},
"queryAllDeclaredFields": true
}These elements would then be accessible via reflection at runtime.
Non-Goals
Support the predefinition of lambdas or proxies.
Make proxy-config.json unnecessary, although this could be considered.
sschuberth