Skip to content

Instantly share code, notes, and snippets.

@timmc
Created June 19, 2015 18:33
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save timmc/1dc26376e3cc475e125e to your computer and use it in GitHub Desktop.
Find where a Clojure namespace was loaded from
;;; This fails in the repl of a project that is AOT-compiled. Not sure why.
;;; You can check for both the source and the compiled version of a namespace.
;;; Remember to munge the namespace -- foo.b-ar becomes foo/b_ar.
(.getResource (class #()) "clojure/core.clj")
;; #<URL jar:file:/home/timmc/.m2/repository/org/clojure/clojure/1.6.0/clojure-1.6.0.jar!/clojure/core.clj>
(.getResource (class #()) "clojure/core__init.class")
;; #<URL jar:file:/home/timmc/.m2/repository/org/clojure/clojure/1.6.0/clojure-1.6.0.jar!/clojure/core__init.class>
;;; If both are present, the class file will take precedence. If they're coming
;;; from different places in your filesystem, you're gonna have a bad time. (AOT conflict.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment