mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
refactoring - use DebuggerUtils
This commit is contained in:
+1
-13
@@ -32,7 +32,6 @@ import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.jdi.VirtualMachineProxyImpl;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.rt.debugger.DefaultMethodInvoker;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.sun.jdi.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -127,18 +126,7 @@ public class MethodEvaluator implements Evaluator {
|
||||
final String methodName = DebuggerUtilsEx.methodName(referenceType.name(), myMethodName, signature);
|
||||
if (isInvokableType(object)) {
|
||||
if (isInvokableType(referenceType)) {
|
||||
Method jdiMethod;
|
||||
if (signature != null) {
|
||||
if (referenceType instanceof ClassType) {
|
||||
jdiMethod = ((ClassType)referenceType).concreteMethodByName(myMethodName, signature);
|
||||
}
|
||||
else {
|
||||
jdiMethod = ContainerUtil.getFirstItem(referenceType.methodsByName(myMethodName, signature));
|
||||
}
|
||||
}
|
||||
else {
|
||||
jdiMethod = ContainerUtil.getFirstItem(referenceType.methodsByName(myMethodName));
|
||||
}
|
||||
Method jdiMethod = DebuggerUtils.findMethod(referenceType, myMethodName, signature);
|
||||
if (jdiMethod != null && jdiMethod.isStatic()) {
|
||||
if (referenceType instanceof ClassType) {
|
||||
return debugProcess.invokeMethod(context, (ClassType)referenceType, jdiMethod, args);
|
||||
|
||||
@@ -42,6 +42,7 @@ import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.StringBuilderSpinAllocator;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.sun.jdi.*;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -149,7 +150,7 @@ public abstract class DebuggerUtils {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Method findMethod(@NotNull ReferenceType refType, @NonNls String methodName, @NonNls String methodSignature) {
|
||||
public static Method findMethod(@NotNull ReferenceType refType, @NonNls String methodName, @Nullable @NonNls String methodSignature) {
|
||||
if (refType instanceof ArrayType) {
|
||||
// for array types methodByName() in JDI always returns empty list
|
||||
final Method method = findMethod(refType.virtualMachine().classesByName(CommonClassNames.JAVA_LANG_OBJECT).get(0), methodName, methodSignature);
|
||||
@@ -164,20 +165,11 @@ public abstract class DebuggerUtils {
|
||||
method = ((ClassType)refType).concreteMethodByName(methodName, methodSignature);
|
||||
}
|
||||
if (method == null) {
|
||||
final List<Method> methods = refType.methodsByName(methodName, methodSignature);
|
||||
if (methods.size() > 0) {
|
||||
method = methods.get(0);
|
||||
}
|
||||
method = ContainerUtil.getFirstItem(refType.methodsByName(methodName, methodSignature));
|
||||
}
|
||||
}
|
||||
else {
|
||||
List<Method> methods = null;
|
||||
if (refType instanceof ClassType) {
|
||||
methods = refType.methodsByName(methodName);
|
||||
}
|
||||
if (methods != null && methods.size() > 0) {
|
||||
method = methods.get(0);
|
||||
}
|
||||
method = ContainerUtil.getFirstItem(refType.methodsByName(methodName));
|
||||
}
|
||||
return method;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user