mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
[debugger] Make EvaluationContextImpl to be UserDataHolder and add evaluation origin to it
IDEA-362361 (cherry picked from commit de48128651bafab7f170ca204c58adafe4fda403) IJ-CR-151042 GitOrigin-RevId: 7b7ff87217b5ab89ba068c9177774a997951f1e9
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3eea2c8961
commit
0dbb5fdb10
@@ -68,7 +68,8 @@ public class JavaDebuggerEvaluator extends XDebuggerEvaluator implements XDebugg
|
||||
|
||||
@Override
|
||||
public void threadAction(@NotNull SuspendContextImpl suspendContext) {
|
||||
ReportingEvaluationCallback callback = wrapToReportingCallback(baseCallback, myDebugProcess.getProject());
|
||||
XEvaluationOrigin origin = getOrigin(baseCallback);
|
||||
ReportingEvaluationCallback callback = new ReportingEvaluationCallback(myDebugProcess.getProject(), baseCallback, origin);
|
||||
WatchItemDescriptor descriptor = null;
|
||||
try {
|
||||
if (DebuggerUIUtil.isObsolete(callback)) {
|
||||
@@ -88,6 +89,7 @@ public class JavaDebuggerEvaluator extends XDebuggerEvaluator implements XDebugg
|
||||
callback.errorOccurred(JavaDebuggerBundle.message("error.context.not.available"), descriptor);
|
||||
return;
|
||||
}
|
||||
XEvaluationOrigin.setOrigin(evalContext, origin);
|
||||
descriptor.setContext(evalContext);
|
||||
EvaluateException exception = descriptor.getEvaluateException();
|
||||
if (exception != null && descriptor.getValue() == null) {
|
||||
@@ -116,7 +118,8 @@ public class JavaDebuggerEvaluator extends XDebuggerEvaluator implements XDebugg
|
||||
|
||||
@Override
|
||||
public void threadAction(@NotNull SuspendContextImpl suspendContext) {
|
||||
ReportingEvaluationCallback callback = wrapToReportingCallback(baseCallback, myDebugProcess.getProject());
|
||||
XEvaluationOrigin origin = getOrigin(baseCallback);
|
||||
ReportingEvaluationCallback callback = new ReportingEvaluationCallback(myDebugProcess.getProject(), baseCallback, origin);
|
||||
if (DebuggerUIUtil.isObsolete(callback)) {
|
||||
return;
|
||||
}
|
||||
@@ -135,6 +138,7 @@ public class JavaDebuggerEvaluator extends XDebuggerEvaluator implements XDebugg
|
||||
callback.errorOccurred(JavaDebuggerBundle.message("error.context.not.available"), descriptor);
|
||||
return;
|
||||
}
|
||||
XEvaluationOrigin.setOrigin(evalContext, origin);
|
||||
|
||||
try {
|
||||
Project project = myDebugProcess.getProject();
|
||||
@@ -171,12 +175,10 @@ public class JavaDebuggerEvaluator extends XDebuggerEvaluator implements XDebugg
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static ReportingEvaluationCallback wrapToReportingCallback(final XEvaluationCallback callback, final Project project) {
|
||||
if (callback instanceof XEvaluationCallbackWithOrigin callbackWithOrigin) {
|
||||
return new ReportingEvaluationCallback(project, callback, callbackWithOrigin.getOrigin());
|
||||
}
|
||||
return new ReportingEvaluationCallback(project, callback, XEvaluationOrigin.UNSPECIFIED);
|
||||
|
||||
private static @NotNull XEvaluationOrigin getOrigin(@NotNull XEvaluationCallback callback) {
|
||||
return callback instanceof XEvaluationCallbackWithOrigin callbackWithOrigin ?
|
||||
callbackWithOrigin.getOrigin() : XEvaluationOrigin.UNSPECIFIED;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.intellij.debugger.jdi.StackFrameProxyImpl;
|
||||
import com.intellij.debugger.jdi.ThreadReferenceProxyImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.ThrowableComputable;
|
||||
import com.intellij.openapi.util.UserDataHolderBase;
|
||||
import com.sun.jdi.ClassLoaderReference;
|
||||
import com.sun.jdi.ObjectReference;
|
||||
import com.sun.jdi.Value;
|
||||
@@ -18,7 +19,7 @@ import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class EvaluationContextImpl implements EvaluationContext {
|
||||
public final class EvaluationContextImpl extends UserDataHolderBase implements EvaluationContext {
|
||||
private final DebuggerComputableValue myThisObject;
|
||||
private final @NotNull SuspendContextImpl mySuspendContext;
|
||||
private final StackFrameProxyImpl myFrameProxy;
|
||||
|
||||
@@ -474,13 +474,17 @@ public abstract class Breakpoint<P extends JavaBreakpointProperties> implements
|
||||
condition,
|
||||
this::createConditionCodeFragment));
|
||||
});
|
||||
|
||||
XEvaluationOrigin originBackup = XEvaluationOrigin.getOrigin(context);
|
||||
boolean evaluationResult;
|
||||
try {
|
||||
if (Registry.is("debugger.retry.conditional.breakpoints", true)) {
|
||||
XEvaluationOrigin.setOrigin(context, XEvaluationOrigin.BREAKPOINT_CONDITION);
|
||||
context.setMayRetryEvaluation(true);
|
||||
}
|
||||
evaluationResult = DebuggerUtilsEx.evaluateBoolean(evaluator, context);
|
||||
} finally {
|
||||
XEvaluationOrigin.setOrigin(context, originBackup);
|
||||
context.setMayRetryEvaluation(false);
|
||||
}
|
||||
JavaDebuggerEvaluatorStatisticsCollector.logEvaluationResult(myProject, evaluator, true, XEvaluationOrigin.BREAKPOINT_CONDITION);
|
||||
|
||||
Reference in New Issue
Block a user