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

Attachments

1

Activity

Show:

Kimmo Koskinen March 13, 2019 at 10:22 PM

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

Kimmo Koskinen January 2, 2019 at 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).

import January 1, 2019 at 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'.

Details

Assignee

Reporter

Labels

Approval

Triaged

Patch

Code

Priority

Created March 30, 2018 at 2:50 PM
Updated March 13, 2019 at 10:22 PM