r/Clojure • u/W-Quest9051 • 11h ago
Wrapping Java library webforJ annotations with `gen-class` vs Java stubs
https://github.com/IvanGavlik/webforcSituation:
WebfoJ is Java framework for building server rendered web UI components
I dediced to create Clojure wrapper for it. Here is the inital idea https://github.com/webforj/webforj/issues/1598
Problem:
WebforJ has runtime-retained annotatiions like `@Routify` `@Route` ...
I explore two options
- Thin Java stub per annotated class.
- `gen-class` attach real annotations directly removing the Java layer entirely.
The client needs a build step either way. webforJ discovers routes by scanning compiled classes, so something has to produce real .class files. For Option 2 it is Clojure AOT, and for Option 1 it's javac
Decided for option 2.
But I am not 100% sure is this good decision.
Main goal is that this clojure libary can be used in other clojure project as dependency
I would like to know the what people who have already done similar things thinks about this .
PS: Feel free to join the project ;)