summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2008-05-02 20:47:07 +0000
committerRich Hickey <richhickey@gmail.com>2008-05-02 20:47:07 +0000
commitf43b443381773086b4570054ed3e556cf004bceb (patch)
tree27da45ea7e172d80a7e3cd81e8b4af59c19c57d6
parent3c61b622e13aa65a668d4635382dfd35c046054c (diff)
added return type to method sig key
-rw-r--r--src/proxy.clj8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/proxy.clj b/src/proxy.clj
index ca9bb13a..eba3117e 100644
--- a/src/proxy.clj
+++ b/src/proxy.clj
@@ -1,3 +1,4 @@
+; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT at the root of this distribution.
@@ -15,6 +16,9 @@
(def *proxy-classes* (ref {}))
+(defn method-sig [#^java.lang.reflect.Method meth]
+ [(. meth (getName)) (seq (. meth (getParameterTypes))) (. meth getReturnType)])
+
(defn get-proxy-class
"Takes an optional single class followed by zero or more
interfaces. If not supplied class defaults to Object. Creates an
@@ -149,7 +153,7 @@
(if meths
(let [#^java.lang.reflect.Method meth (first meths)
mods (. meth (getModifiers))
- mk [(. meth (getName)) (seq (. meth (getParameterTypes)))]]
+ mk (method-sig meth)]
(if (or (considered mk)
(. Modifier (isPrivate mods))
(. Modifier (isStatic mods))
@@ -175,7 +179,7 @@
;add methods matching interfaces', if no mapping -> throw
(doseq #^Class iface interfaces
(doseq #^java.lang.reflect.Method meth (. iface (getMethods))
- (when-not (contains? mm [(. meth (getName)) (seq (. meth (getParameterTypes)))])
+ (when-not (contains? mm (method-sig meth))
(gen-method meth
(fn [gen m]
(. gen (throwException ex-type (. m (getName))))))))))