Don't trust modifiable-classloader? on Java 1.9+.

Might fix #2331?
This commit is contained in:
Phil Hagelberg 2017-10-24 10:49:43 -07:00
parent 0bb57fa038
commit a0beae8d8a
2 changed files with 5 additions and 3 deletions

View file

@ -238,7 +238,7 @@
(File/createTempFile "form-init" ".clj"))]
(spit init-file
(binding [*print-dup* *eval-print-dup*]
(pr-str (if-not (System/getenv "LEIN_FAST_TRAMPOLINE")
(pr-str (when-not (System/getenv "LEIN_FAST_TRAMPOLINE")
`(.deleteOnExit (File. ~(.getCanonicalPath init-file))))
form)))
`(~(or (:java-cmd project) (System/getenv "JAVA_CMD") "java")

View file

@ -745,8 +745,10 @@
(defn ensure-dynamic-classloader []
(let [thread (Thread/currentThread)
cl (.getContextClassLoader thread)]
(when-not (pomegranate/modifiable-classloader? cl)
cl (.getContextClassLoader thread)
java-version (Float. (System/getProperty "java.specification.version"))]
(when-not (and (pomegranate/modifiable-classloader? cl)
(< java-version 1.9))
(.setContextClassLoader thread (DynamicClassLoader. cl)))))
(def ^:private registered-wagon-files (atom #{}))