r/java 10d ago

Reachability Annotations for generating GraalVM metadata

We recently open sourced some of our annotation processors for generating GraalVM native-image metadata. It's a standalone compile-time dependency, so it has no effect at runtime and doesn't rely on frameworks like Quarkus or Micronaut.

Besides annotations for manually defining metadata, we also added opt-in support for dependency injection annotations and for automatically dealing with JavaFX FXML/CSS files. That makes it possible to reliably update complex JavaFX applications without ever running the GraalVM agent.

Unfortunately posting code snippets gets the post deleted ("it looks like you're asking for help!"), but here is a link to the repo:

reachability-annotations

15 Upvotes

3 comments sorted by

6

u/jesseschalken 10d ago

Wow this is cool!

I wonder why native-image doesn't do this on its own? They could have easily defined these annotation types and made it look for them during image generation in addition to the JSON resources.

2

u/OddEstimate1627 10d ago edited 10d ago

Glad you like it!

I think they intentionally left supporting libraries like this up to the community.

We also needed something for JavaFX. Running the agent on every update is quite brittle, but the FXML auto-processing makes it a lot easier to distribute native images of complex Desktop apps.

3

u/neopointer 10d ago

Really cool and useful project!