groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Minor refactoring
Date Sat, 24 Jun 2017 07:03:29 GMT
Repository: groovy
Updated Branches:
  refs/heads/master bc2f4eb50 -> 6606079ef


Minor refactoring


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/6606079e
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/6606079e
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/6606079e

Branch: refs/heads/master
Commit: 6606079ef3fff700a9ec733223ed71873c7cead8
Parents: bc2f4eb
Author: sunlan <sunlan@apache.org>
Authored: Sat Jun 24 15:03:21 2017 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Sat Jun 24 15:03:21 2017 +0800

----------------------------------------------------------------------
 .../org/apache/groovy/parser/antlr4/AstBuilder.java | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/6606079e/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
index aa2d0f8..3aa1805 100644
--- a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
+++ b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
@@ -1239,11 +1239,11 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object>
implements Groov
             return;
         }
 
-        Arrays.stream(parameters).forEach(e -> {
-            if (e.hasInitialExpression()) {
-                throw createParsingFailedException("Cannot specify default value for method
parameter '" + e.getName() + " = " + e.getInitialExpression().getText() + "' inside an interface",
e);
+        for (Parameter parameter : parameters) {
+            if (parameter.hasInitialExpression()) {
+                throw createParsingFailedException("Cannot specify default value for method
parameter '" + parameter.getName() + " = " + parameter.getInitialExpression().getText() +
"' inside an interface", parameter);
             }
-        });
+        }
     }
 
     @Override
@@ -1279,7 +1279,10 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object>
implements Groov
                         modifierManager));
 
         if (modifierManager.contains(STATIC)) {
-            Arrays.stream(methodNode.getParameters()).forEach(e -> e.setInStaticContext(true));
+            for (Parameter parameter : methodNode.getParameters()) {
+                parameter.setInStaticContext(true);
+            }
+
             methodNode.getVariableScope().setInStaticContext(true);
         }
 
@@ -2158,7 +2161,6 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object>
implements Groov
         throw createParsingFailedException("Unsupported path element: " + ctx.getText(),
ctx);
     }
 
-
     @Override
     public GenericsType[] visitNonWildcardTypeArguments(NonWildcardTypeArgumentsContext ctx)
{
         if (!asBoolean(ctx)) {
@@ -3702,7 +3704,7 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object>
implements Groov
     public ClassNode visitAnnotatedQualifiedClassName(AnnotatedQualifiedClassNameContext
ctx) {
         ClassNode classNode = this.visitQualifiedClassName(ctx.qualifiedClassName());
 
-        this.visitAnnotationsOpt(ctx.annotationsOpt()).forEach(classNode::addAnnotation);
+        classNode.addAnnotations(this.visitAnnotationsOpt(ctx.annotationsOpt()));
 
         return classNode;
     }


Mime
View raw message