From 1003557c49dee9ec983abd38bede82f42e6b4d62 Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Thu, 26 Aug 2010 14:47:17 +0400 Subject: [PATCH] usability: MethodReturnValueWatcher to store results from non-void methods only (IDEA-57994) --- .../engine/requests/MethodReturnValueWatcher.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/requests/MethodReturnValueWatcher.java b/java/debugger/impl/src/com/intellij/debugger/engine/requests/MethodReturnValueWatcher.java index 16fc43ce1639..d0acd7f9704a 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/requests/MethodReturnValueWatcher.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/requests/MethodReturnValueWatcher.java @@ -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) { }