From d74645c2acb558c3c7ea12f09216ac7adaf43905 Mon Sep 17 00:00:00 2001 From: Nicola Mometto Date: Fri, 18 Oct 2024 13:59:05 +0100 Subject: [PATCH] feat: array-class for multi-dimension --- .../clojure/tools/analyzer/jvm/utils.clj | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/clojure/clojure/tools/analyzer/jvm/utils.clj b/src/main/clojure/clojure/tools/analyzer/jvm/utils.clj index b5782a3..1332add 100644 --- a/src/main/clojure/clojure/tools/analyzer/jvm/utils.clj +++ b/src/main/clojure/clojure/tools/analyzer/jvm/utils.clj @@ -67,13 +67,16 @@ "Takes a Symbol, String or Class and tires to resolve to a matching Class" class) -(defn array-class [element-type] - (RT/classForName - (str "[" (-> element-type - maybe-class - Type/getType - .getDescriptor - (.replace \/ \.))))) +(defn array-class + ([element-type] (array-class 1 element-type)) + ([n element-type] + (RT/classForName + (str (apply str (repeat n"[")) + (-> element-type + maybe-class + Type/getType + .getDescriptor + (.replace \/ \.)))))) (defn maybe-class-from-string [^String s] (or (when-let [maybe-class (and (neg? (.indexOf s "."))