IDEA-141596 Debugger: recursion in self references

This commit is contained in:
Egor.Ushakov
2017-04-05 16:57:52 +03:00
parent 4a682d81d8
commit 18c4f549a2
5 changed files with 13 additions and 4 deletions

View File

@@ -151,7 +151,7 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider, XV
myValueDescriptor.updateRepresentation(myEvaluationContext, new DescriptorLabelListener() {
@Override
public void labelChanged() {
Icon nodeIcon = DebuggerTreeRenderer.getValueIcon(myValueDescriptor);
Icon nodeIcon = DebuggerTreeRenderer.getValueIcon(myValueDescriptor, myParent != null ? myParent.getDescriptor() : null);
final String value = getValueString();
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
EvaluateException exception = myValueDescriptor.getEvaluateException();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 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.
@@ -35,6 +35,8 @@ import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
import com.intellij.xdebugger.impl.ui.XDebugSessionTab;
import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants;
import com.intellij.xdebugger.impl.ui.tree.ValueMarkup;
import com.sun.jdi.ObjectReference;
import com.sun.jdi.Value;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -74,7 +76,7 @@ public class DebuggerTreeRenderer extends ColoredTreeCellRenderer {
nodeIcon = stackDescriptor.getIcon();
}
else if (descriptor instanceof ValueDescriptorImpl) {
nodeIcon = getValueIcon((ValueDescriptorImpl)descriptor);
nodeIcon = getValueIcon((ValueDescriptorImpl)descriptor, null);
}
else if (descriptor instanceof MessageDescriptor) {
MessageDescriptor messageDescriptor = (MessageDescriptor)descriptor;
@@ -95,11 +97,17 @@ public class DebuggerTreeRenderer extends ColoredTreeCellRenderer {
return nodeIcon;
}
public static Icon getValueIcon(ValueDescriptorImpl valueDescriptor) {
public static Icon getValueIcon(ValueDescriptorImpl valueDescriptor, @Nullable ValueDescriptorImpl parentDescriptor) {
Icon nodeIcon;
if (valueDescriptor instanceof FieldDescriptorImpl) {
FieldDescriptorImpl fieldDescriptor = (FieldDescriptorImpl)valueDescriptor;
nodeIcon = PlatformIcons.FIELD_ICON;
if (parentDescriptor != null) {
Value value = valueDescriptor.getValue();
if (value instanceof ObjectReference && value.equals(parentDescriptor.getValue())) {
nodeIcon = AllIcons.Debugger.Selfreference;
}
}
if (fieldDescriptor.getField().isFinal()) {
nodeIcon = new LayeredIcon(nodeIcon, AllIcons.Nodes.FinalMark);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

View File

@@ -295,6 +295,7 @@ public class AllIcons {
public static final Icon NewWatch = IconLoader.getIcon("/debugger/newWatch.png"); // 16x16
public static final Icon Question_badge = IconLoader.getIcon("/debugger/question_badge.png"); // 6x9
public static final Icon RestoreLayout = IconLoader.getIcon("/debugger/restoreLayout.png"); // 16x16
public static final Icon Selfreference = IconLoader.getIcon("/debugger/selfreference.png"); // 16x16
public static final Icon ShowCurrentFrame = IconLoader.getIcon("/debugger/showCurrentFrame.png"); // 16x16
public static final Icon SmartStepInto = IconLoader.getIcon("/debugger/smartStepInto.png"); // 16x16
public static final Icon StackFrame = IconLoader.getIcon("/debugger/stackFrame.png"); // 16x16