[hg] main-silver: bugfix #232602, implement Instance.getValueOfF...

  • From: Tomas Hurka < >
  • To:
  • Subject: [hg] main-silver: bugfix #232602, implement Instance.getValueOfF...
  • Date: Mon, 15 Jul 2013 03:48:12 -0700

changeset e52275c5e1b5 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/e52275c5e1b5
description:
        bugfix #232602, implement Instance.getValueOfField()

diffstat:

 
debugger.jpda.heapwalk/src/org/netbeans/modules/debugger/jpda/heapwalk/InstanceImpl.java
 |  23 +++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diffs (50 lines):

diff --git 
a/debugger.jpda.heapwalk/src/org/netbeans/modules/debugger/jpda/heapwalk/InstanceImpl.java
 
b/debugger.jpda.heapwalk/src/org/netbeans/modules/debugger/jpda/heapwalk/InstanceImpl.java
--- 
a/debugger.jpda.heapwalk/src/org/netbeans/modules/debugger/jpda/heapwalk/InstanceImpl.java
+++ 
b/debugger.jpda.heapwalk/src/org/netbeans/modules/debugger/jpda/heapwalk/InstanceImpl.java
@@ -52,6 +52,7 @@
 
 import java.util.ArrayList;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -60,6 +61,7 @@
 import org.netbeans.api.debugger.jpda.JPDAClassType;
 import org.netbeans.api.debugger.jpda.ObjectVariable;
 import org.netbeans.api.debugger.jpda.Variable;
+import org.netbeans.lib.profiler.heap.ObjectFieldValue;
 import org.openide.util.Exceptions;
 
 /**
@@ -154,10 +156,29 @@
     }
 
     public Object getValueOfField(String name) {
-        // TODO
+        Iterator fIt = getFieldValues().iterator();
+        FieldValue matchingFieldValue = null;
+
+        while (fIt.hasNext()) {
+            FieldValue fieldValue = (FieldValue) fIt.next();
+
+            if (fieldValue.getField().getName().equals(name)) {
+                matchingFieldValue = fieldValue;
+            }
+        }
+
+        if (matchingFieldValue == null) {
         return null;
    }
 
+        if (matchingFieldValue instanceof ObjectFieldValue) {
+            return ((ObjectFieldValue) matchingFieldValue).getInstance();
+        } else {
+            return ((FieldValue) matchingFieldValue).getValue();
+        }
+
+   }
+
     public List<FieldValue> getStaticFieldValues() {
         return getJavaClass().getStaticFieldValues();
     }

[hg] main-silver: bugfix #232602, implement Instance.getValueOfF...

Tomas Hurka 07/15/2013

Project Features

About this Project

Debugger was started in November 2009, is owned by tpavek, and has 29 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close