Skip to content

Commit 9e5669d

Browse files
committed
Display fields transitively in Merged Fields
1 parent 7d5d781 commit 9e5669d

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

visualvm/heapviewer/src/org/graalvm/visualvm/heapviewer/java/impl/JavaFieldsPlugin.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,9 @@ protected boolean sorts(DataType dataType) {
619619
}
620620
protected HeapViewerNode createNode(Instance object) {
621621
return new InstanceNode(object) {
622-
public boolean isLeaf() {
623-
return true;
622+
protected HeapViewerNode[] lazilyComputeChildren(Heap heap, String viewID, HeapViewerNodeFilter viewFilter, List<DataType> dataTypes, List<SortOrder> sortOrders, Progress progress) throws InterruptedException {
623+
List<FieldValue> fields = JavaFieldsProvider.InstanceFieldsProvider.getFields(this, heap, true, true);
624+
return JavaFieldsProvider.getNodes(fields, this, heap, viewID, viewFilter, dataTypes, sortOrders, progress);
624625
}
625626
};
626627
}

visualvm/heapviewer/src/org/graalvm/visualvm/heapviewer/java/impl/JavaFieldsProvider.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import org.graalvm.visualvm.heapviewer.model.Progress;
4545
import org.graalvm.visualvm.heapviewer.ui.UIThresholds;
4646
import org.graalvm.visualvm.heapviewer.utils.NodesComputer;
47-
import static org.graalvm.visualvm.heapviewer.utils.NodesComputer.integerIterator;
4847
import org.graalvm.visualvm.heapviewer.utils.ProgressIterator;
4948
import org.openide.util.NbBundle;
5049
import org.openide.util.lookup.ServiceProvider;
@@ -129,14 +128,18 @@ public boolean supportsNode(HeapViewerNode parent, Heap heap, String viewID) {
129128

130129

131130
protected List<FieldValue> getFields(HeapViewerNode parent, Heap heap) {
131+
return getFields(parent, heap, includeInstanceFields, includeStaticFields);
132+
}
133+
134+
static List<FieldValue> getFields(HeapViewerNode parent, Heap heap, boolean instanceFields, boolean staticFields) {
132135
Instance instance = HeapViewerNode.getValue(parent, DataType.INSTANCE, heap);
133136
if (instance == null) return null;
134137

135-
if (includeStaticFields == includeInstanceFields) {
138+
if (staticFields == instanceFields) {
136139
List<FieldValue> fields = new ArrayList(instance.getFieldValues());
137140
fields.addAll(instance.getStaticFieldValues());
138141
return fields;
139-
} else if (includeInstanceFields) {
142+
} else if (instanceFields) {
140143
return instance.getFieldValues();
141144
} else {
142145
return instance.getStaticFieldValues();

0 commit comments

Comments
 (0)