[hg] main-silver: #220790: Recognize fields from static imports.

  • From:
  • To:
  • Subject: [hg] main-silver: #220790: Recognize fields from static imports.
  • Date: Thu, 15 Nov 2012 02:38:02 -0800

changeset 36647a48992a in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/36647a48992a
description:
        #220790: Recognize fields from static imports.

diffstat:

 
debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/EvaluatorVisitor.java
 |  23 ++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diffs (40 lines):

diff --git 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/EvaluatorVisitor.java
 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/EvaluatorVisitor.java
--- 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/EvaluatorVisitor.java
+++ 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/EvaluatorVisitor.java
@@ -1930,6 +1930,27 @@
                 }
                 Field field = declaringType.fieldByName(fieldName);
                 if (field == null) {
+                    // Check the enclosing class...
+                    if (enclosingClass != null && 
!enclosingClass.equals(declaringType.name())) {
+                        vm = 
evaluationContext.getDebugger().getVirtualMachine();
+                        if (vm == null) {
+                            return null;
+                        }
+                        declaringType = getOrLoadClass(vm, enclosingClass, 
evaluationContext);
+                        if (declaringType != null) {
+                            field = declaringType.fieldByName(fieldName);
+                        } else {
+                            // Unknown class, try to get a constant value, 
if it's a constant...
+                            Object constantValue = ve.getConstantValue();
+                            if (constantValue != null) {
+                                return mirrorOf(vm, constantValue);
+                            } else {
+                                Assert.error(arg0, "unknownType", 
enclosingClass);
+                            }
+                        }
+                    }
+                }
+                if (field == null) {
                     Assert.error(arg0, "unknownVariable", fieldName);
                 }
                 if (field.isStatic()) {
@@ -3977,6 +3998,8 @@
             return new FloatVal(vm, ((Float)value).floatValue());
         } else if (value instanceof Double) {
             return new DoubleVal(vm, ((Double)value).doubleValue());
+        } else if (value instanceof String) {
+            return vm.mirrorOf((String) value);
         }
         return null;
     }

[hg] main-silver: #220790: Recognize fields from static imports.

mentlicher 11/15/2012

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 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close