This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-21
Channels
- # aws (2)
- # bangalore-clj (14)
- # beginners (20)
- # boot (20)
- # cider (7)
- # cljs-dev (38)
- # cljsrn (13)
- # clojure (487)
- # clojure-argentina (3)
- # clojure-dev (15)
- # clojure-gamedev (4)
- # clojure-italy (3)
- # clojure-poland (1)
- # clojure-russia (1)
- # clojure-spec (25)
- # clojure-uk (47)
- # clojurescript (127)
- # datomic (125)
- # defnpodcast (1)
- # hoplon (27)
- # jobs (4)
- # lein-figwheel (2)
- # leiningen (1)
- # luminus (5)
- # off-topic (3)
- # om (25)
- # onyx (9)
- # parinfer (3)
- # pedestal (20)
- # planck (65)
- # re-frame (43)
- # reagent (4)
- # remote-jobs (1)
- # ring-swagger (2)
- # rum (9)
- # spacemacs (1)
- # unrepl (37)
- # vim (1)
Am I correct in thinking that if I load Clojure from Java, by loading a class which requires RT, then clojure.core
will always be loaded from the TCCL via RT.baseLoader()
?
I can’t set Compiler.LOADER
or RT.USE_CONTEXT_CLASSLOADER
, since manipulation either of them will cause RT
to be loaded, which will try to use the TCCL to load clojure.core
.
in whatever version of clojure I have checked out it looks like RT.USE_CONTEXT_CLASSLOADER defaults to true
could you x = getContextClassLoader() try { setContextClassLoader(null); loadClojure(); } finally { setContextClassLoader(x); } or whatever?
I can’t do that unfortunately. I’m trying to use Clojure-compiled classes in IntelliJ. The classes are instantiated by IntelliJ, and I can’t set the TCCL when that happens. If a class that IntelliJ wants is compiled by Clojure and thus has an implicit RT dependency, and Clojure hasn’t been loaded yet, then I get an ExceptionInInitializerException and the class can’t load.
I suppose this is an effort to replace a java stub class with one generated by clojure, so suggesting a java stub class isn't going to help
I can do that, yes, it’s more or less what I’m doing at the moment. It’s fairly awful though, I basically end up writing manual gen-class-like classes in Java.
And I have to write a lot of them. I’m running a fork of Clojure, so I think I’ll just modify baseLoader()
you could do a custom gen-class macro too (but I bet the baseloader mod is less work)
on the other end of the work spectrum you could patch the class file's static initializer to do the tccl dance
Right, or modify my fork to change how https://dev.clojure.org/jira/browse/CLJ-1208 works. But that’s still going to be a nasty hack, and more invasive than just fixing baseLoader() I think.