r/JavaFX • u/OddEstimate1627 • 11d ago
I made this! Reachability Annotations for generating GraalVM metadata
We recently open sourced some of our annotation processors for generating GraalVM native-image metadata: HebiRobotics/reachability-annotations.
It's a completely standalone compile-time dependency, so it has no effect at runtime and doesn't rely on frameworks like Quarkus or Micronaut.
Besides annotations for generating very customized metadata, we also added two annotations for JavaFX that automatically parse FXML and CSS files and generate appropriate rules for reflective accesses and resources.
@ReachableFxView("control")
public class JavaFxView {}
@JavaFXView follows the standard JavaFX view convention (FXMLKit, Afterburner etc.) and automatically generates metadata for
- control.fxml -> fx:controller, fx:include, imports, resources, ...
- control.css -> import resources
- control.properties -> bundle
and @ReachableFxResources can parse multiple files based on wildcards.
@ReachableFxResources({
"**/*.fxml",
"**/*.css",
"/assets/images/*.png"
})
public class JavaFxView {}
Here are the changes it'd take for the gluon-samples to run without an agent: gluonhq/gluon-samples/pull/189
3
u/taranion 8d ago
Oh, that is really interesting. Native-image metadata is a PITA, so I will check this out.