use of com.sun.jdi.Method in project intellij-community by JetBrains.
the class ForceEarlyReturnAction method actionPerformed.
public void actionPerformed(@NotNull AnActionEvent e) {
final Project project = e.getProject();
final JavaStackFrame stackFrame = PopFrameAction.getStackFrame(e);
if (stackFrame == null || project == null) {
return;
}
final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext());
final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
if (debugProcess == null) {
return;
}
final StackFrameProxyImpl proxy = stackFrame.getStackFrameProxy();
final ThreadReferenceProxyImpl thread = proxy.threadProxy();
debugProcess.getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext, thread) {
@Override
public void threadAction() {
Method method;
try {
method = proxy.location().method();
} catch (EvaluateException e) {
showError(project, DebuggerBundle.message("error.early.return", e.getLocalizedMessage()));
return;
}
if ("void".equals(method.returnTypeName())) {
forceEarlyReturnWithFinally(thread.getVirtualMachine().mirrorOfVoid(), stackFrame, debugProcess, null);
} else {
ApplicationManager.getApplication().invokeLater(() -> new ReturnExpressionDialog(project, debugProcess.getXdebugProcess().getEditorsProvider(), debugProcess, stackFrame).show());
}
}
});
}
use of com.sun.jdi.Method in project intellij-community by JetBrains.
the class ExecutionWithDebuggerToolsTestCase method printFrameProxy.
protected void printFrameProxy(StackFrameProxyImpl frameProxy) throws EvaluateException {
int frameIndex = frameProxy.getFrameIndex();
Method method = frameProxy.location().method();
println("frameProxy(" + frameIndex + ") = " + method, ProcessOutputTypes.SYSTEM);
}
use of com.sun.jdi.Method in project che by eclipse.
the class Evaluator method findMethod.
private Method findMethod(List<Method> methods, List<Value> arguments) {
Method m = null;
for (Method mm : methods) {
List<Type> argumentTypes;
try {
argumentTypes = mm.argumentTypes();
} catch (ClassNotLoadedException e) {
continue;
}
ARGUMENT_MATCHING argumentMatching = argumentsMatching(argumentTypes, arguments);
if (argumentMatching == ARGUMENT_MATCHING.MATCH) {
m = mm;
break;
} else if (argumentMatching == ARGUMENT_MATCHING.ASSIGNABLE) {
if (m == null) {
m = mm;
} else {
throw new ExpressionException("Multiple methods with name " + mm.name() + " matched to specified arguments. ");
}
}
}
return m;
}
use of com.sun.jdi.Method in project gravel by gravel-st.
the class VMTargetStarter method installHaltPoint.
private void installHaltPoint(VirtualMachine vm) {
List<ReferenceType> targetClasses = vm.classesByName(VMLocalTarget.class.getName());
ReferenceType classRef = targetClasses.get(0);
Method meth = classRef.methodsByName("haltPoint").get(0);
BreakpointRequest req = vm.eventRequestManager().createBreakpointRequest(meth.location());
req.setSuspendPolicy(BreakpointRequest.SUSPEND_EVENT_THREAD);
req.enable();
}
use of com.sun.jdi.Method in project intellij-community by JetBrains.
the class BasicStepMethodFilter method locationMatches.
public boolean locationMatches(final DebugProcessImpl process, final Location location) throws EvaluateException {
Method method = location.method();
String name = method.name();
if (!myTargetMethodName.equals(name)) {
if (DebuggerUtilsEx.isLambdaName(name)) {
SourcePosition position = process.getPositionManager().getSourcePosition(location);
return ReadAction.compute(() -> {
PsiElement psiMethod = DebuggerUtilsEx.getContainingMethod(position);
if (psiMethod instanceof PsiLambdaExpression) {
PsiType type = ((PsiLambdaExpression) psiMethod).getFunctionalInterfaceType();
PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(type);
if (type != null && interfaceMethod != null && myTargetMethodName.equals(interfaceMethod.getName())) {
try {
return InheritanceUtil.isInheritor(type, myDeclaringClassName.getName(process).replace('$', '.'));
} catch (EvaluateException e) {
LOG.info(e);
}
}
}
return false;
});
}
return false;
}
if (myTargetMethodSignature != null && !signatureMatches(method, myTargetMethodSignature.getName(process))) {
return false;
}
if (method.isBridge()) {
// skip bridge methods
return false;
}
return DebuggerUtilsEx.isAssignableFrom(myDeclaringClassName.getName(process), location.declaringType());
}
Aggregations