summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Solano Gómez <clojure@sattvik.com>2011-02-13 12:52:44 -0600
committerStuart Halloway <stu@Stuart-Halloways-MacBook-Air.local>2011-02-25 16:19:30 -0500
commite006863d50a164976627311f577726fcd917a9ff (patch)
tree7bd4ef21e0bd55de230127c403c7969cbdea3ce5
parentad8e72dd2adb66acf3c568d0d75dbd3b96e33577 (diff)
Allow definterface/gen-interface to accept array type hints
Signed-off-by: Stuart Halloway <stu@Stuart-Halloways-MacBook-Air.local>
-rw-r--r--src/clj/clojure/genclass.clj19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/clj/clojure/genclass.clj b/src/clj/clojure/genclass.clj
index 052d0cbb..08c0ee94 100644
--- a/src/clj/clojure/genclass.clj
+++ b/src/clj/clojure/genclass.clj
@@ -71,14 +71,22 @@
(def ^{:private true} prim->class
{'int Integer/TYPE
+ 'ints (Class/forName "[I")
'long Long/TYPE
+ 'longs (Class/forName "[J")
'float Float/TYPE
+ 'floats (Class/forName "[F")
'double Double/TYPE
+ 'doubles (Class/forName "[D")
'void Void/TYPE
'short Short/TYPE
+ 'shorts (Class/forName "[S")
'boolean Boolean/TYPE
+ 'booleans (Class/forName "[Z")
'byte Byte/TYPE
- 'char Character/TYPE})
+ 'bytes (Class/forName "[B")
+ 'char Character/TYPE
+ 'chars (Class/forName "[C")})
(defn- ^Class the-class [x]
(cond
@@ -623,14 +631,7 @@
fully-qualified class name given as a string or symbol
(such as 'java.lang.String)"
[c]
- (if (or (instance? Class c) (prim->class c))
- (Type/getType (the-class c))
- (let [strx (str c)]
- (Type/getObjectType
- (.replace (if (some #{\.} strx)
- strx
- (str "java.lang." strx))
- "." "/")))))
+ (Type/getType (the-class c)))
(defn- generate-interface
[{:keys [name extends methods]}]