Skip to content

Commit

Permalink
Make dynamic classpath modification robust to compiler loader binding
Browse files Browse the repository at this point in the history
When the current classloader has no modifiable ancestor, do not rely on the
compiler's classloader var binding, as it may be unbound in some circumstances.
Instead, create a new dynamic classloader with the clojure runtime's ancestry.
  • Loading branch information
Jeff Valk committed Jan 24, 2021
1 parent 95030a3 commit e3de281
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/orchard/java/classpath.clj
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
[^URL url]
(let [loader (or (modifiable-classloader)
(set-classloader!
(modifiable-classloader @Compiler/LOADER)))]
(modifiable-classloader (clojure.lang.DynamicClassLoader.
(clojure.lang.RT/baseLoader)))))]
(when (dp/add-classpath-url loader url)
url)))

Expand Down

0 comments on commit e3de281

Please sign in to comment.