Welcome! Please see the About page for a little more info on how this works.

0 votes
in Compiler by

Currently gen-class only works while AOT compiling, but just evaluates to nil while JIT loading.
The reason for this behaviour is historical and no longer relvant since CLJ-979 landed in 1.7, which fixed the dynamic classloader definition issues and also made this exact same change for gen-interface. The only reason why this wasn't also done for gen-class is that I forgot about it.

This patch fixes this inconsistency

Patch: 0001-CLJ-2343-define-and-load-class-while-JITing-gen-clas.patch

4 Answers

0 votes
by

Comment made by: kari

Just asking if the issue I asked in Clojure Slack relates to this JIRA issue.
If I have a gen-class (e.g. mygenclass) as part of my Clojure project and I want to refresh all namespaces in Clojure REPL using command:
(do (require '(link: clojure.tools.namespace.repl :refer [refresh)]) (refresh))
... then I get an error: "namespace 'mygenclass' not found after loading 'mygenclass'.

0 votes
by

Comment made by: viesti

Now that there is (link: https://clojure.org/guides/deps_and_cli#aot_compilation text: Deps and CLI), this change would make it even more easier package a library using that uses gen-class, since no class files would need to be packaged (if I understood correctly).

0 votes
by

Comment made by: viesti

Just a friendly nudge, is the anything that could be helped with this change? :)

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-2343 (reported by bronsa)
...