mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-13 15:52:01 +07:00
IDEA-377806 Incorrect origin in debugger evaluator statistics
(cherry picked from commit 1a42c215342b3c328ee11e65a58d80bae85ea85f) IJ-CR-172916 GitOrigin-RevId: cc7ca83198faa03987201005023906dd2a79f1ff
This commit is contained in:
committed by
intellij-monorepo-bot
parent
dfd32d1e59
commit
0fbde78035
@@ -97,8 +97,15 @@ public abstract class EvaluationDescriptor extends ValueDescriptorImpl {
|
||||
throw EvaluateExceptionUtil.NULL_STACK_FRAME;
|
||||
}
|
||||
|
||||
Value value = XEvaluationOrigin.computeWithOrigin(thisEvaluationContext, XEvaluationOrigin.RENDERER,
|
||||
() -> evaluator.evaluate(thisEvaluationContext));
|
||||
XEvaluationOrigin descriptorOrigin = XEvaluationOrigin.getOrigin(this);
|
||||
Value value;
|
||||
if (descriptorOrigin != XEvaluationOrigin.UNSPECIFIED) {
|
||||
value = XEvaluationOrigin.computeWithOrigin(thisEvaluationContext, descriptorOrigin,
|
||||
() -> evaluator.evaluate(thisEvaluationContext));
|
||||
}
|
||||
else {
|
||||
value = evaluator.evaluate(thisEvaluationContext);
|
||||
}
|
||||
thisEvaluationContext.keep(value);
|
||||
|
||||
myModifier = evaluator.getModifier();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.debugger.ui.tree.render;
|
||||
|
||||
import com.intellij.debugger.DebuggerContext;
|
||||
@@ -15,6 +15,7 @@ import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.JDOMExternalizerUtil;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.xdebugger.impl.ui.tree.nodes.XEvaluationOrigin;
|
||||
import com.sun.jdi.Value;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -114,6 +115,7 @@ public final class EnumerationChildrenRenderer extends ReferenceRenderer impleme
|
||||
childInfo.myExpression);
|
||||
data.setEnumerationIndex(idx++);
|
||||
UserExpressionDescriptor descriptor = descriptorFactory.getUserExpressionDescriptor(builder.getParentDescriptor(), data);
|
||||
XEvaluationOrigin.setOrigin(descriptor, XEvaluationOrigin.RENDERER);
|
||||
if (childInfo.myOnDemand) {
|
||||
descriptor.putUserData(OnDemandRenderer.ON_DEMAND_CALCULATED, false);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.intellij.xdebugger.impl.ui.tree.nodes
|
||||
|
||||
import com.intellij.openapi.util.Key
|
||||
import com.intellij.openapi.util.ThrowableComputable
|
||||
import com.intellij.openapi.util.UserDataHolder
|
||||
import com.intellij.openapi.util.UserDataHolderBase
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@@ -25,18 +26,33 @@ enum class XEvaluationOrigin {
|
||||
|
||||
@ApiStatus.Internal
|
||||
@JvmStatic
|
||||
@Deprecated("Use the non deprecated overload", level = DeprecationLevel.HIDDEN)
|
||||
fun getOrigin(holder: UserDataHolderBase): XEvaluationOrigin {
|
||||
return getOrigin(holder)
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
@JvmStatic
|
||||
fun getOrigin(holder: UserDataHolder): XEvaluationOrigin {
|
||||
return ORIGIN_KEY.get(holder, UNSPECIFIED)
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
@JvmStatic
|
||||
@Deprecated("Use the non deprecated overload", level = DeprecationLevel.HIDDEN)
|
||||
fun setOrigin(holder: UserDataHolderBase, origin: XEvaluationOrigin) {
|
||||
setOrigin(holder, origin)
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
@JvmStatic
|
||||
fun setOrigin(holder: UserDataHolder, origin: XEvaluationOrigin) {
|
||||
ORIGIN_KEY.set(holder, origin.takeIf { it != UNSPECIFIED })
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
@JvmStatic
|
||||
@Deprecated("Use the non deprecated overload", level = DeprecationLevel.HIDDEN)
|
||||
fun <T> computeWithOrigin(holder: UserDataHolderBase, origin: XEvaluationOrigin, block: ThrowableComputable<T, *>): T {
|
||||
val previous = holder.getUserData(ORIGIN_KEY)
|
||||
try {
|
||||
@@ -47,5 +63,18 @@ enum class XEvaluationOrigin {
|
||||
holder.putUserData(ORIGIN_KEY, previous)
|
||||
}
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
@JvmStatic
|
||||
fun <T> computeWithOrigin(holder: UserDataHolder, origin: XEvaluationOrigin, block: ThrowableComputable<T, *>): T {
|
||||
val previous = holder.getUserData(ORIGIN_KEY)
|
||||
try {
|
||||
holder.putUserData(ORIGIN_KEY, origin)
|
||||
return block.compute()
|
||||
}
|
||||
finally {
|
||||
holder.putUserData(ORIGIN_KEY, previous)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user