Skip to content

Instantly share code, notes, and snippets.

@schmir
Created June 20, 2014 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schmir/f7a75f1167ecfad51c2d to your computer and use it in GitHub Desktop.
Save schmir/f7a75f1167ecfad51c2d to your computer and use it in GitHub Desktop.
(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