8000 properly handling prims · clojure/clojure@7bfb0bc · GitHub
[go: up one dir, main page]

Skip to content

Commit 7bfb0bc

Browse files
committed
properly handling prims
1 parent e21285a commit 7bfb0bc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/clj/clojure/genclass.clj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,14 @@
107107
(clojure.lang.Util/isPosDigit (name x))
108108
(-> x name (.charAt 0) int (- (int \0))))]
109109
(let [cn (namespace x)
110-
classname (if (some #{\.} cn) cn (str "java.lang." cn))]
111-
(str (String/join "" ^Iterable (repeat dim "[")) "L" classname ";"))
110+
^Class pc (prim->class (symbol cn))
111+
classname (cond (some #{\.} cn) cn
112+
pc (-> pc Type/getType Type/.getDescriptor)
113+
:default (str "java.lang." cn))
114+
^Iterable dim-descr (repeat dim "[")]
115+
(if pc
116+
(str (String/join "" dim-descr) classname)
117+
(str (String/join "" dim-descr) "L" classname ";")))
112118
(str x)))
113119

114120
(defn- ^Class the-class [x]

0 commit comments

Comments
 (0)
0