diff options
Diffstat (limited to 'java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java')
-rw-r--r-- | java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java index 69cbb140be86..2569559d2d11 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java @@ -30,7 +30,10 @@ import com.intellij.debugger.engine.evaluation.EvaluateRuntimeException; import com.intellij.debugger.engine.evaluation.EvaluationContextImpl; import com.intellij.debugger.impl.DebuggerUtilsEx; import com.intellij.openapi.diagnostic.Logger; -import com.sun.jdi.*; +import com.sun.jdi.ClassType; +import com.sun.jdi.Method; +import com.sun.jdi.ObjectReference; +import com.sun.jdi.ReferenceType; import java.util.ArrayList; import java.util.List; @@ -127,14 +130,16 @@ public class MethodEvaluator implements Evaluator { _refType = ((ClassType)referenceType).superclass(); } Method jdiMethod = DebuggerUtils.findMethod(_refType, myMethodName, signature); - if (jdiMethod == null || jdiMethod.argumentTypes().size() != args.size()) { + if (signature == null) { + // we know nothing about expected method's signature, so trying to match my method name and parameter count // dummy matching, may be improved with types matching later - List<Method> methods = _refType.methodsByName(myMethodName); - for (Method method : methods) { - List<Type> types = method.argumentTypes(); - if (types.size() == args.size()) { - jdiMethod = method; - break; + // IMPORTANT! using argumentTypeNames() instead of argumentTypes() to avoid type resolution inside JDI, which may be time-consuming + if (jdiMethod == null || jdiMethod.argumentTypeNames().size() != args.size()) { + for (Method method : _refType.methodsByName(myMethodName)) { + if (method.argumentTypeNames().size() == args.size()) { + jdiMethod = method; + break; + } } } } |