rdonkin 2002/11/21 11:38:52
Modified: lang/src/java/org/apache/commons/lang/reflect
MethodUtils.java
Log:
Make MethodUtils depend on ReflectionUtils parameter set comparasons
Revision Changes Path
1.8 +21 -40
jakarta-commons/lang/src/java/org/apache/commons/lang/reflect/MethodUtils.java
Index: MethodUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/reflect/MethodUtils.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- MethodUtils.java 21 Nov 2002 18:53:32 -0000 1.7
+++ MethodUtils.java 21 Nov 2002 19:38:51 -0000 1.8
@@ -561,50 +561,31 @@
// compare parameters
Class[] methodsParams = methods[i].getParameterTypes();
- int methodParamSize = methodsParams.length;
- if (methodParamSize == paramSize) {
- boolean match = true;
- for (int n = 0 ; n < methodParamSize; n++) {
+ if (ReflectionUtils.isCompatible(parameterTypes, methodsParams)) {
+ // get accessible version of method
+ Method method = getAccessibleMethod(methods[i]);
+ if (method != null) {
if (debug) {
- log("Param=" + parameterTypes[n].getName());
- log("Method=" + methodsParams[n].getName());
+ log(method + " accessible version of "
+ + methods[i]);
}
- if (!ReflectionUtils.isCompatible(parameterTypes[n],
methodsParams[n])) {
- if (debug) {
- log(methodsParams[n] + " is not assignable from "
- + parameterTypes[n]);
- }
- match = false;
- break;
+ try {
+ //
+ // XXX Default access superclass workaround
+ // (See above for more details.)
+ //
+ method.setAccessible(true);
+
+ } catch (SecurityException se) {
+ // log but continue just in case the method.invoke
works anyway
+ log(
+ "Cannot setAccessible on method. Therefore cannot use
jvm access bug workaround.",
+ se);
}
+ return method;
}
- if (match) {
- // get accessible version of method
- Method method = getAccessibleMethod(methods[i]);
- if (method != null) {
- if (debug) {
- log(method + " accessible version of "
- + methods[i]);
- }
- try {
- //
- // XXX Default access superclass workaround
- // (See above for more details.)
- //
- method.setAccessible(true);
-
- } catch (SecurityException se) {
- // log but continue just in case the method.invoke
works anyway
- log(
- "Cannot setAccessible on method. Therefore cannot
use jvm access bug workaround.",
- se);
- }
- return method;
- }
-
- log("Couldn't find accessible method.");
- }
+ log("Couldn't find accessible method.");
}
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>