提交 e31a44a4 authored 作者: Thomas Mueller's avatar Thomas Mueller

Renamed method names.

上级 5f4b6f23
...@@ -502,7 +502,7 @@ public class Utils { ...@@ -502,7 +502,7 @@ public class Utils {
int lastDot = classAndMethod.lastIndexOf('.'); int lastDot = classAndMethod.lastIndexOf('.');
String className = classAndMethod.substring(0, lastDot); String className = classAndMethod.substring(0, lastDot);
String methodName = classAndMethod.substring(lastDot + 1); String methodName = classAndMethod.substring(lastDot + 1);
return classMethodInternal(methodName, Class.forName(className), null, params); return callMethod(null, Class.forName(className), methodName, params);
} }
/** /**
...@@ -519,12 +519,12 @@ public class Utils { ...@@ -519,12 +519,12 @@ public class Utils {
Object instance, Object instance,
String methodName, String methodName,
Object... params) throws Exception { Object... params) throws Exception {
return classMethodInternal(methodName, instance.getClass(), instance, params); return callMethod(instance, instance.getClass(), methodName, params);
} }
private static Object classMethodInternal( private static Object callMethod(
String methodName, Class<?> clazz, Object instance, Class<?> clazz,
Object instance, String methodName,
Object... params) throws Exception { Object... params) throws Exception {
Method best = null; Method best = null;
int bestMatch = 0; int bestMatch = 0;
...@@ -575,9 +575,12 @@ public class Utils { ...@@ -575,9 +575,12 @@ public class Utils {
int points = 1; int points = 1;
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
Class<?> pc = getNonPrimitiveClass(params[i]); Class<?> pc = getNonPrimitiveClass(params[i]);
Class<?> vc = values[i].getClass(); Object v = values[i];
Class<?> vc = v == null ? null : v.getClass();
if (pc == vc) { if (pc == vc) {
points++; points++;
} else if (vc == null) {
// can't verify
} else if (!pc.isAssignableFrom(vc)) { } else if (!pc.isAssignableFrom(vc)) {
return 0; return 0;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论