} else {
obj = (ObjectReference)invoker;
methods = obj.referenceType().methodsByName(methodName);
}
if (methods == null || methods.size() == 0) {
throw new ExpressionEvalException("eval expression error, method '" + methodName + "' can't be found");
}
if (methods.size() == 1) {
matchedMethod = methods.get(0);
} else {
matchedMethod = findMatchedMethod(methods, args);
}
try {
if (invoker instanceof ClassType) {
ClassType clazz = (ClassType)refType;
value = clazz.invokeMethod(threadRef, matchedMethod, args,
ObjectReference.INVOKE_SINGLE_THREADED);
} else {
value = obj.invokeMethod(threadRef, matchedMethod, args,
ObjectReference.INVOKE_SINGLE_THREADED);
}
} catch (InvalidTypeException e) {
e.printStackTrace();
throw new ExpressionEvalException("eval expression error, caused by :" + e.getMessage());
} catch (ClassNotLoadedException e) {
e.printStackTrace();
throw new ExpressionEvalException("eval expression error, caused by :" + e.getMessage());
} catch (IncompatibleThreadStateException e) {
e.printStackTrace();
throw new ExpressionEvalException("eval expression error, caused by :" + e.getMessage());
} catch (InvocationException e) {
e.printStackTrace();
throw new ExpressionEvalException("eval expression error, caused by :" + e.getMessage());
}
return value;
}