File tree 3 files changed +16
-8
lines changed
test/clojure/test_clojure
3 files changed +16
-8
lines changed Original file line number Diff line number Diff line change 107
107
(clojure.lang.Util/isPosDigit (name x))
108
108
(-> x name (.charAt 0 ) int (- (int \0 ))))]
109
109
(let [cn (namespace x)
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
110
^Iterable dim-descr (repeat dim " [" )]
115
- (if pc
116
- (str (String/join " " dim-descr) classname)
117
- (str (String/join " " dim-descr) " L" classname " ;" )))
111
+ (if-let [^Class pc (clojure.lang.Compiler/primClass (symbol cn))]
112
+ (str (String/join " " dim-descr) (-> pc Type/getType Type/.getDescriptor))
113
+ (str (String/join " " dim-descr) " L"
114
+ (if (some #{\.} cn) cn (str " java.lang." cn))
115
+ " ;" )))
118
116
(str x)))
119
117
120
118
(defn- ^Class the-class [x]
Original file line number Diff line number Diff line change @@ -9184,7 +9184,7 @@ static Class retType(Class tc, Class ret){
9184
9184
return tc ;
9185
9185
}
9186
9186
9187
- static Class primClass (Symbol sym ){
9187
+ public static Class primClass (Symbol sym ){
9188
9188
if (sym == null )
9189
9189
return null ;
9190
9190
Class c = null ;
Original file line number Diff line number Diff line change 149
149
(visitSource [source debug] (.append sourceFile source)))]
150
150
(.accept classReader sourceVisitor 0 )
151
151
(is (= " examples.clj" (str sourceFile)))))
152
+
153
+ (deftest array-descriptors->class
154
+ (are [descr c] (= (#'clojure.core/the-class descr) c)
155
+ " [Ljava.util.UUID;" java.util.UUID/1
156
+ 'String java.lang.String
157
+ 'String/1 java.lang.String/1
158
+ 'java.util.UUID java.util.UUID
159
+ 'java.util.UUID/2 java.util.UUID/2
160
+ 'int/1 int/1
161
+ 'boolean/9 boolean/9 ))
You can’t perform that action at this time.
0 commit comments