mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-151452 any exception with condition constantly says "Cannot find source class for current stack frame"
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,6 +27,7 @@ import com.intellij.debugger.impl.DebuggerSession;
|
||||
import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
|
||||
import com.intellij.openapi.progress.util.ProgressWindowWithNotification;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.xdebugger.frame.XValueModifier;
|
||||
import com.sun.jdi.*;
|
||||
@@ -216,12 +217,14 @@ public abstract class JavaValueModifier extends XValueModifier {
|
||||
public void threadAction() {
|
||||
ExpressionEvaluator evaluator;
|
||||
try {
|
||||
evaluator = DebuggerInvocationUtil
|
||||
.commitAndRunReadAction(evaluationContext.getProject(), new EvaluatingComputable<ExpressionEvaluator>() {
|
||||
final Project project = evaluationContext.getProject();
|
||||
evaluator = DebuggerInvocationUtil.commitAndRunReadAction(project, new EvaluatingComputable<ExpressionEvaluator>() {
|
||||
public ExpressionEvaluator compute() throws EvaluateException {
|
||||
return EvaluatorBuilderImpl
|
||||
.build(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, expression), ContextUtil.getContextElement(evaluationContext),
|
||||
ContextUtil.getSourcePosition(evaluationContext));
|
||||
.build(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, expression),
|
||||
ContextUtil.getContextElement(evaluationContext),
|
||||
ContextUtil.getSourcePosition(evaluationContext),
|
||||
project);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+4
-7
@@ -59,13 +59,10 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
public static ExpressionEvaluator build(final TextWithImports text, @Nullable PsiElement contextElement, final SourcePosition position) throws EvaluateException {
|
||||
if (contextElement == null) {
|
||||
throw EvaluateExceptionUtil.CANNOT_FIND_SOURCE_CLASS;
|
||||
}
|
||||
|
||||
final Project project = contextElement.getProject();
|
||||
|
||||
public static ExpressionEvaluator build(final TextWithImports text,
|
||||
@Nullable PsiElement contextElement,
|
||||
@Nullable final SourcePosition position,
|
||||
@NotNull Project project) throws EvaluateException {
|
||||
CodeFragmentFactory factory = DebuggerUtilsEx.findAppropriateCodeFragmentFactory(text, contextElement);
|
||||
PsiCodeFragment codeFragment = factory.createCodeFragment(text, contextElement, project);
|
||||
if (codeFragment == null) {
|
||||
|
||||
@@ -269,10 +269,13 @@ public abstract class Breakpoint<P extends JavaBreakpointProperties> implements
|
||||
|
||||
final TextWithImports expressionToEvaluate = getLogMessage();
|
||||
try {
|
||||
ExpressionEvaluator evaluator = DebuggerInvocationUtil.commitAndRunReadAction(getProject(), new EvaluatingComputable<ExpressionEvaluator>() {
|
||||
ExpressionEvaluator evaluator = DebuggerInvocationUtil.commitAndRunReadAction(myProject, new EvaluatingComputable<ExpressionEvaluator>() {
|
||||
@Override
|
||||
public ExpressionEvaluator compute() throws EvaluateException {
|
||||
return EvaluatorBuilderImpl.build(expressionToEvaluate, ContextUtil.getContextElement(context), ContextUtil.getSourcePosition(context));
|
||||
return EvaluatorBuilderImpl.build(expressionToEvaluate,
|
||||
ContextUtil.getContextElement(context),
|
||||
ContextUtil.getSourcePosition(context),
|
||||
myProject);
|
||||
}
|
||||
});
|
||||
final Value eval = evaluator.evaluate(context);
|
||||
@@ -353,7 +356,8 @@ public abstract class Breakpoint<P extends JavaBreakpointProperties> implements
|
||||
}
|
||||
|
||||
try {
|
||||
ExpressionEvaluator evaluator = DebuggerInvocationUtil.commitAndRunReadAction(context.getProject(), new EvaluatingComputable<ExpressionEvaluator>() {
|
||||
final Project project = context.getProject();
|
||||
ExpressionEvaluator evaluator = DebuggerInvocationUtil.commitAndRunReadAction(project, new EvaluatingComputable<ExpressionEvaluator>() {
|
||||
@Override
|
||||
public ExpressionEvaluator compute() throws EvaluateException {
|
||||
final SourcePosition contextSourcePosition = ContextUtil.getSourcePosition(context);
|
||||
@@ -364,7 +368,7 @@ public abstract class Breakpoint<P extends JavaBreakpointProperties> implements
|
||||
if (contextPsiElement == null) {
|
||||
contextPsiElement = getEvaluationElement(); // as a last resort
|
||||
}
|
||||
return EvaluatorBuilderImpl.build(getCondition(), contextPsiElement, contextSourcePosition);
|
||||
return EvaluatorBuilderImpl.build(getCondition(), contextPsiElement, contextSourcePosition, project);
|
||||
}
|
||||
});
|
||||
Object value = UnBoxingEvaluator.unbox(evaluator.evaluate(context), context);
|
||||
|
||||
Reference in New Issue
Block a user