Make MethodUtils depend on ReflectionUtils parameter set comparasons
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137142 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4f24da86c7
commit
3e9065d2df
|
@ -82,7 +82,7 @@ import org.apache.commons.lang.StringUtils;
|
||||||
* @author Gregor Raýman
|
* @author Gregor Raýman
|
||||||
* @author Jan Sorensen
|
* @author Jan Sorensen
|
||||||
* @author Robert Burrell Donkin
|
* @author Robert Burrell Donkin
|
||||||
* @version $Id: MethodUtils.java,v 1.7 2002/11/21 18:53:32 rdonkin Exp $
|
* @version $Id: MethodUtils.java,v 1.8 2002/11/21 19:38:51 rdonkin Exp $
|
||||||
*/
|
*/
|
||||||
public class MethodUtils {
|
public class MethodUtils {
|
||||||
|
|
||||||
|
@ -561,50 +561,31 @@ public class MethodUtils {
|
||||||
|
|
||||||
// compare parameters
|
// compare parameters
|
||||||
Class[] methodsParams = methods[i].getParameterTypes();
|
Class[] methodsParams = methods[i].getParameterTypes();
|
||||||
int methodParamSize = methodsParams.length;
|
if (ReflectionUtils.isCompatible(parameterTypes, methodsParams)) {
|
||||||
if (methodParamSize == paramSize) {
|
// get accessible version of method
|
||||||
boolean match = true;
|
Method method = getAccessibleMethod(methods[i]);
|
||||||
for (int n = 0 ; n < methodParamSize; n++) {
|
if (method != null) {
|
||||||
if (debug) {
|
if (debug) {
|
||||||
log("Param=" + parameterTypes[n].getName());
|
log(method + " accessible version of "
|
||||||
log("Method=" + methodsParams[n].getName());
|
+ methods[i]);
|
||||||
}
|
}
|
||||||
if (!ReflectionUtils.isCompatible(parameterTypes[n], methodsParams[n])) {
|
try {
|
||||||
if (debug) {
|
//
|
||||||
log(methodsParams[n] + " is not assignable from "
|
// XXX Default access superclass workaround
|
||||||
+ parameterTypes[n]);
|
// (See above for more details.)
|
||||||
}
|
//
|
||||||
match = false;
|
method.setAccessible(true);
|
||||||
break;
|
|
||||||
|
} 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) {
|
log("Couldn't find accessible method.");
|
||||||
// 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.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue