diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/clj/clojure/boot.clj | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/clj/clojure/boot.clj b/src/clj/clojure/boot.clj index de1e8715..b7d7ac78 100644 --- a/src/clj/clojure/boot.clj +++ b/src/clj/clojure/boot.clj @@ -3610,9 +3610,29 @@ (.append w c)) nil) +(def primitives-classnames + {Float/TYPE "Float/TYPE" + Integer/TYPE "Integer/TYPE" + Long/TYPE "Long/TYPE" + Boolean/TYPE "Boolean/TYPE" + Character/TYPE "Character/TYPE" + Double/TYPE "Double/TYPE" + Byte/TYPE "Byte/TYPE" + Short/TYPE "Short/TYPE"}) + (defmethod print-method Class [#^Class c, #^Writer w] - (.write w "#=") - (.write w (.getName c))) + (cond + (.isPrimitive c) (do + (.write w "#=(identity ") + (.write w (primitives-classnames c)) + (.write w ")")) + (.isArray c) (do + (.write w "#=(java.lang.Class/forName \"") + (.write w (.getName c)) + (.write w "\")")) + :else (do + (.write w "#=") + (.write w (.getName c))))) (defmethod print-method java.math.BigDecimal [b, #^Writer w] (.write w (str b)) |