summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2008-11-20 16:56:17 +0000
committerRich Hickey <richhickey@gmail.com>2008-11-20 16:56:17 +0000
commit083c5e1c61096f70d783bfad4d3319d9a5242171 (patch)
tree20f03eefd50d03a0f94b3ffc45520d9df324d79f /src
parentace90a251f8dfc86c5e5587ce110cbd05956902b (diff)
enhanced bridge method handling
Diffstat (limited to 'src')
-rw-r--r--src/clj/clojure/core.clj2
-rw-r--r--src/jvm/clojure/lang/Reflector.java40
2 files changed, 27 insertions, 15 deletions
diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
index 1957f4f9..626facb8 100644
--- a/src/clj/clojure/core.clj
+++ b/src/clj/clojure/core.clj
@@ -3106,7 +3106,7 @@
references (remove #(= :gen-class (first %)) references)]
`(do
(clojure.core/in-ns '~name)
- ~@(when (and (not= name '~'clojure.core) (not-any? #(= :refer-clojure (first %)) references))
+ ~@(when (and (not= name 'clojure.core) (not-any? #(= :refer-clojure (first %)) references))
`((clojure.core/refer '~'clojure.core)))
~@(map process-reference references))))
diff --git a/src/jvm/clojure/lang/Reflector.java b/src/jvm/clojure/lang/Reflector.java
index 0eaf1123..c553a8b1 100644
--- a/src/jvm/clojure/lang/Reflector.java
+++ b/src/jvm/clojure/lang/Reflector.java
@@ -299,27 +299,39 @@ static public Field getField(Class c, String name, boolean getStatics){
static public List getMethods(Class c, int arity, String name, boolean getStatics){
Method[] allmethods = c.getMethods();
ArrayList methods = new ArrayList();
+ ArrayList bridgeMethods = new ArrayList();
for(int i = 0; i < allmethods.length; i++)
{
- try
+ Method method = allmethods[i];
+ if(name.equals(method.getName())
+ && Modifier.isStatic(method.getModifiers()) == getStatics
+ && method.getParameterTypes().length == arity)
{
- Method method = allmethods[i];
- if(name.equals(method.getName())
- && Modifier.isStatic(method.getModifiers()) == getStatics
- && method.getParameterTypes().length == arity
- && (!method.isBridge()
- || (c == StringBuilder.class &&
- c.getMethod(method.getName(), method.getParameterTypes())
- .equals(method))))
+ try
+ {
+ if(method.isBridge()
+ && c.getMethod(method.getName(), method.getParameterTypes())
+ .equals(method))
+ bridgeMethods.add(method);
+ else
+ methods.add(method);
+ }
+ catch(NoSuchMethodException e)
{
- methods.add(allmethods[i]);
}
}
- catch(NoSuchMethodException e)
- {
- throw new RuntimeException(e);
- }
+// && (!method.isBridge()
+// || (c == StringBuilder.class &&
+// c.getMethod(method.getName(), method.getParameterTypes())
+// .equals(method))))
+// {
+// methods.add(allmethods[i]);
+// }
}
+
+ if(methods.isEmpty())
+ methods.addAll(bridgeMethods);
+
if(!getStatics && c.isInterface())
{
allmethods = Object.class.getMethods();