groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [22/50] groovy git commit: Minor refactoring
Date Tue, 11 Apr 2017 01:37:58 GMT
Minor refactoring


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

Branch: refs/heads/master
Commit: 7d0c69092fea12f2e93e5f367120afb081877e76
Parents: a5f4eba
Author: sunlan <sunlan@apache.org>
Authored: Thu Jan 26 01:04:09 2017 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Thu Jan 26 01:04:09 2017 +0800

----------------------------------------------------------------------
 .../apache/groovy/parser/antlr4/AstBuilder.java   | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/7d0c6909/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
b/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
index 7f81e19..d46019c 100644
--- a/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
+++ b/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
@@ -139,7 +139,6 @@ import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
 import static org.apache.groovy.parser.antlr4.GroovyLangParser.*;
-import static org.apache.groovy.parser.antlr4.GroovyParser.ElementValuesContext;
 import static org.codehaus.groovy.runtime.DefaultGroovyMethods.asBoolean;
 import static org.codehaus.groovy.runtime.DefaultGroovyMethods.last;
 
@@ -496,8 +495,7 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object>
implements Groov
                         this.visitFinallyBlock(ctx.finallyBlock()));
 
         if (asBoolean(ctx.resources())) {
-            this.visitResources(ctx.resources()).stream()
-                    .forEach(tryCatchStatement::addResource);
+            this.visitResources(ctx.resources()).forEach(tryCatchStatement::addResource);
         }
 
         ctx.catchClause().stream().map(this::visitCatchClause)
@@ -626,7 +624,7 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object>
implements Groov
         List<CaseStatement> caseStatementList = new LinkedList<>();
         List<Statement> defaultStatementList = new LinkedList<>();
 
-        statementList.stream().forEach(e -> {
+        statementList.forEach(e -> {
             if (e instanceof CaseStatement) {
                 caseStatementList.add((CaseStatement) e);
             } else if (isTrue(e, IS_SWITCH_DEFAULT)) {
@@ -980,7 +978,7 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object>
implements Groov
             this.visitEnumConstants(ctx.enumConstants());
         }
 
-        ctx.classBodyDeclaration().stream().forEach(e -> {
+        ctx.classBodyDeclaration().forEach(e -> {
             e.putNodeMetaData(CLASS_DECLARATION_CLASS_NODE, classNode);
             this.visitClassBodyDeclaration(e);
         });
@@ -1274,7 +1272,7 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object>
implements Groov
 
             modifierManager.processMethodNode(methodNode);
         }
-        anonymousInnerClassList.stream().forEach(e -> e.setEnclosingMethod(methodNode));
+        anonymousInnerClassList.forEach(e -> e.setEnclosingMethod(methodNode));
 
         methodNode.setGenericsTypes(this.visitTypeParameters(ctx.typeParameters()));
         methodNode.setSyntheticPublic(
@@ -1403,7 +1401,7 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object>
implements Groov
         ClassNode classNode = ctx.getNodeMetaData(CLASS_DECLARATION_CLASS_NODE);
 
         if (asBoolean(classNode)) {
-            declarationExpressionList.stream().forEach(e -> {
+            declarationExpressionList.forEach(e -> {
                 VariableExpression variableExpression = (VariableExpression) e.getLeftExpression();
 
                 int modifiers = modifierManager.getClassMemberModifiersOpValue();
@@ -1459,7 +1457,7 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object>
implements Groov
             return null;
         }
 
-        declarationExpressionList.stream().forEach(e -> {
+        declarationExpressionList.forEach(e -> {
             VariableExpression variableExpression = (VariableExpression) e.getLeftExpression();
 
             modifierManager.processVariableExpression(variableExpression);
@@ -4080,14 +4078,14 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object>
implements Groov
         public List<ExpressionStatement> getDeclarationStatements() {
             List<String> declarationListStatementLabels = this.getStatementLabels();
 
-            this.declarationStatements.stream().forEach(e -> {
+            this.declarationStatements.forEach(e -> {
                 if (asBoolean((Object) declarationListStatementLabels)) {
                     // clear existing statement labels before setting labels
                     if (asBoolean((Object) e.getStatementLabels())) {
                         e.getStatementLabels().clear();
                     }
 
-                    declarationListStatementLabels.stream().forEach(e::addStatementLabel);
+                    declarationListStatementLabels.forEach(e::addStatementLabel);
                 }
             });
 


Mime
View raw message