Archived
I wrote a annotatation processor instead, take a look https://github.com/mageddo-projects/annotation-processing-tools/tree/master/reflection-config-generator
Graal Reflection Configuration Generator provides an easy way to geenrate GraalVM reflection config files, configure the plugin on your gradle project, annotate the desired class class with @RuntimeReflection
run the gradle build then you're done.
See an example app
Using
Gradle dependencies
dependencies {
compileOnly("com.mageddo.nativeimage:reflection-config-generator:2.1.1")
annotationProcessor("com.mageddo.nativeimage:reflection-config-generator:2.1.1")
}
Consider the following example
package com.acme;
import nativeimage.Reflection;
@Reflection(declaredConstructors = true, declaredFields = true)
public class Fruit {
private String name;
private String color;
}
it will automatically configure reflection for Fruit
props when compiling using native-image generating a json like
[
{
"name" : "com.acme.Fruit",
"allDeclaredConstructors" : true,
"allPublicConstructors" : false,
"allDeclaredMethods" : false,
"allPublicMethods" : false,
"allPublicFields" : false,
"allDeclaredFields" : true
}
]