How can a static initializer be defined using gen-class-Collection of common programming errors
I don’t believe this is possible in pure gen-class at present. clojure’s gen-class always generates a static initializer where it ties the generated class to the clojure runtime with a call to
clojure.lang.Var#internPrivate(String, String)
There is some flexibility in the generation of that static initializer (see the :load-impl-ns option to gen-class), but there isn’t a way to add your own custom code to the initializer that I can see after reviewing genclass.clj.
btw – as a slight aside, in the JVM the name of the static initializer ‘method’ is