Created
June 20, 2014 12:13
-
-
Save schmir/f7a75f1167ecfad51c2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(in-ns 'clojure.core) | |
;; make reloading namespaces work with proxy! | |
(defn proxy-name** | |
{:tag String} | |
[^Class super interfaces] | |
(let [inames (into1 (sorted-set) (map #(.getName ^Class %) interfaces)) | |
ihashes (into1 (sorted-set) (map #(System/identityHashCode %) interfaces))] | |
(apply str (.replace (str *ns*) \- \_) ".proxy" | |
(interleave (repeat "$") | |
(concat | |
[(.getName super)] | |
(map #(subs % (inc (.lastIndexOf ^String % "."))) inames) | |
[(Integer/toHexString (hash ihashes))]))))) | |
(defn proxy-name | |
{:tag String} | |
[^Class super interfaces] | |
(let [r (proxy-name** super interfaces)] | |
(println "using patched proxy-name" [super interfaces] r) | |
r)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment