[hg] main-silver: #224716: Lambda expressions and member referen...

  • From:
  • To:
  • Subject: [hg] main-silver: #224716: Lambda expressions and member referen...
  • Date: Tue, 19 Mar 2013 16:37:57 -0700

changeset 335cc0441395 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/335cc0441395
description:
        #224716: Lambda expressions and member references are recognized by 
evaluator, but they can not be evaluated, because they require creation of a 
new class.

diffstat:

 debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/Bundle.properties  
   |   4 +-
 
debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/EvaluatorVisitor.java
 |  27 ++++++++++
 2 files changed, 29 insertions(+), 2 deletions(-)

diffs (64 lines):

diff --git 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/Bundle.properties 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/Bundle.properties
--- 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/Bundle.properties
+++ 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/Bundle.properties
@@ -94,7 +94,7 @@
 CTL_EvalError_arrayIsNull = Array \"{0}\" is null object.
 CTL_EvalError_unknownInternalError = Unable to evaluate expression: internal 
error \"{0}\".
 CTL_EvalError_collected = The object was collected.
-CTL_EvalError_unsupported = Unsupported, not an expression: \"{0}\"
+CTL_EvalError_unsupported = Unsupported expression: \"{0}\"
 CTL_EvalError_errorneous = Malformed expression: \"{0}\"
 CTL_EvalError_unknownField = Unknown field \"{0}\"
 CTL_EvalError_unknownOuterClass = Unknown outer class \"{0}\"
@@ -107,5 +107,5 @@
 CTL_EvalError_canNotInvokeMethods = Unable to evaluate method calls.
 CTL_EvalError_notABoolean = Expression \"{0}\" did not return a boolean 
value, but: {1} of type {2}.
 CTL_EvalError_notAValue = Cannot evaluate
-CTL_EvalError_noNewClassWithBody = Can not create a class with a new body.
+CTL_EvalError_noNewClassWithBody = Unsupported: can not create a new class.
 #CTL_EvalErrorExpr = Error in evaluation of expression \"{0}\": {1}.
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
@@ -120,7 +120,9 @@
 import com.sun.source.tree.InstanceOfTree;
 import com.sun.source.tree.IntersectionTypeTree;
 import com.sun.source.tree.LabeledStatementTree;
+import com.sun.source.tree.LambdaExpressionTree;
 import com.sun.source.tree.LiteralTree;
+import com.sun.source.tree.MemberReferenceTree;
 import com.sun.source.tree.MemberSelectTree;
 import com.sun.source.tree.MethodInvocationTree;
 import com.sun.source.tree.MethodTree;
@@ -3518,6 +3520,31 @@
         return intersectionType;
     }
     
+    @Override
+    public Mirror visitLambdaExpression(LambdaExpressionTree node, 
EvaluationContext p) {
+        /**
+         * A tree node for a lambda expression.
+         * It creates a new class, which is unsupported.
+         */
+        
+        Assert.error(node, "noNewClassWithBody");
+        return super.visitLambdaExpression(node, p);
+    }
+
+    @Override
+    public Mirror visitMemberReference(MemberReferenceTree node, 
EvaluationContext p) {
+        /**
+         * A tree node for a member reference expression.
+         * There are two kinds of member references:
+         *   method references (ReferenceMode.INVOKE) and
+         *   constructor references (ReferenceMode.NEW).
+         * It creates a new class, which is unsupported.
+         */
+
+        Assert.error(node, "noNewClassWithBody");
+        return super.visitMemberReference(node, p);
+    }
+
     private Value setToMirror(Tree var, Value value, EvaluationContext 
evaluationContext) {
         VariableInfo varInfo = evaluationContext.getVariableInfo(var);
         if (varInfo == null) {

[hg] main-silver: #224716: Lambda expressions and member referen...

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