usability: MethodReturnValueWatcher to store results from non-void methods only (IDEA-57994)

This commit is contained in:
Eugene Zhuravlev
2010-08-26 16:15:45 +04:00
parent 8a7c002c56
commit 1003557c49
@@ -52,14 +52,20 @@ public class MethodReturnValueWatcher {
return false;
}
try {
myLastExecutedMethod = event.method();
final Method method = event.method();
//myLastMethodReturnValue = event.returnValue();
try {
if (myReturnValueMethod == null) {
//noinspection HardCodedStringLiteral
myReturnValueMethod = MethodExitEvent.class.getDeclaredMethod("returnValue", ArrayUtil.EMPTY_CLASS_ARRAY);
}
myLastMethodReturnValue = (Value)myReturnValueMethod.invoke(event);
final Value retVal = (Value)myReturnValueMethod.invoke(event);
if (method == null || !"void".equals(method.returnTypeName())) {
// remember methods with non-void return types only
myLastExecutedMethod = method;
myLastMethodReturnValue = retVal;
}
}
catch (NoSuchMethodException ignored) {
}