define and load classes in memory with gen-class

Description

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 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

Environment

None

Activity

Show:
import
January 1, 2019, 6:33 PM

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 '[clojure.tools.namespace.repl :refer [refresh]]) (refresh))
... then I get an error: "namespace 'mygenclass' not found after loading 'mygenclass'.

Kimmo Koskinen
January 2, 2019, 9:37 PM

Now that there is 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).

Kimmo Koskinen
March 13, 2019, 10:22 PM

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

Assignee

Unassigned

Reporter

Nicola Mometto

Labels

Approval

Triaged

Patch

Code

Priority

Major
Configure