Skip to content

Commit 4a29ce2

Browse files
amalloystuarthalloway
authored andcommitted
Print metadata and anonymous classes better
Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
1 parent 7ac5ad8 commit 4a29ce2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/clj/clojure/core_print.clj

+6-2
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,13 @@
8888
(.write w ")"))
8989

9090
(defn- print-object [o, ^Writer w]
91+
(when (instance? clojure.lang.IMeta o)
92+
(print-meta o w))
9193
(.write w "#<")
92-
(.write w (.getSimpleName (class o)))
93-
(.write w " ")
94+
(let [name (.getSimpleName (class o))]
95+
(when (seq name) ;; anonymous classes have a simple name of ""
96+
(.write w name)
97+
(.write w " ")))
9498
(.write w (str o))
9599
(.write w ">"))
96100

0 commit comments

Comments
 (0)