summaryrefslogtreecommitdiff
path: root/src/jvm
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/jvm
parentace90a251f8dfc86c5e5587ce110cbd05956902b (diff)
enhanced bridge method handling
Diffstat (limited to 'src/jvm')
-rw-r--r--src/jvm/clojure/lang/Reflector.java40
1 files changed, 26 insertions, 14 deletions
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();