groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [groovy] branch GROOVY_3_0_X updated: Refactor code (closes #1076)
Date Mon, 11 Nov 2019 06:10:13 GMT
This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push:
     new 7785567  Refactor code (closes #1076)
7785567 is described below

commit 77855679b584035bddb3384f5c2458e712a02418
Author: mattisonchao <mattisonchao@gmail.com>
AuthorDate: Sat Nov 9 20:54:56 2019 +0800

    Refactor code (closes #1076)
    
    I refactor some code about java7 and some performance issues.
    
    --Learn and contribute to groovy.
---
 .../codehaus/groovy/antlr/AntlrParserPlugin.java   | 56 +++++++++++-----------
 .../org/codehaus/groovy/ast/AnnotationNode.java    |  2 +-
 .../ast/builder/AstBuilderTransformation.java      |  4 +-
 .../codehaus/groovy/ast/decompiled/ClassStub.java  |  2 +-
 .../groovy/classgen/AsmClassGenerator.java         | 10 ++--
 .../runtime/metaclass/ConcurrentReaderHashMap.java | 12 ++---
 .../transform/AbstractASTTransformation.java       | 20 ++++----
 .../stc/AbstractTypeCheckingExtension.java         |  4 +-
 8 files changed, 55 insertions(+), 55 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java b/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java
index c2f9407..e36d5ca 100644
--- a/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java
+++ b/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java
@@ -295,7 +295,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
         if ("html".equals(formatProp)) {
             try {
                 PrintStream out = new PrintStream(new FileOutputStream(sourceUnit.getName()
+ ".html"));
-                List<VisitorAdapter> v = new ArrayList<VisitorAdapter>();
+                List<VisitorAdapter> v = new ArrayList<>();
                 v.add(new NodeAsHTMLPrinter(out, tokenNames));
                 v.add(new SourcePrinter(out, tokenNames));
                 Visitor visitors = new CompositeVisitor(v);
@@ -391,7 +391,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
     //-------------------------------------------------------------------------
 
     protected void packageDef(AST packageDef) {
-        List<AnnotationNode> annotations = new ArrayList<AnnotationNode>();
+        List<AnnotationNode> annotations = new ArrayList<>();
         AST node = packageDef.getFirstChild();
         if (isType(ANNOTATIONS, node)) {
             processAnnotations(annotations, node);
@@ -409,7 +409,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
             output.putNodeMetaData(ImportNode.class, ImportNode.class);
 
             boolean isStatic = importNode.getType() == STATIC_IMPORT;
-            List<AnnotationNode> annotations = new ArrayList<AnnotationNode>();
+            List<AnnotationNode> annotations = new ArrayList<>();
 
             AST node = importNode.getFirstChild();
             if (isType(ANNOTATIONS, node)) {
@@ -488,7 +488,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
     }
 
     protected void annotationDef(AST classDef) {
-        List<AnnotationNode> annotations = new ArrayList<AnnotationNode>();
+        List<AnnotationNode> annotations = new ArrayList<>();
         AST node = classDef.getFirstChild();
         int modifiers = Opcodes.ACC_PUBLIC;
         if (isType(MODIFIERS, node)) {
@@ -535,7 +535,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
     }
 
     protected void innerInterfaceDef(AST classDef) {
-        List<AnnotationNode> annotations = new ArrayList<AnnotationNode>();
+        List<AnnotationNode> annotations = new ArrayList<>();
         AST node = classDef.getFirstChild();
         int modifiers = Opcodes.ACC_PUBLIC;
         if (isType(MODIFIERS, node)) {
@@ -627,7 +627,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
     }
 
     protected void innerClassDef(AST classDef) {
-        List<AnnotationNode> annotations = new ArrayList<AnnotationNode>();
+        List<AnnotationNode> annotations = new ArrayList<>();
 
         if (isType(TRAIT_DEF, classDef)) {
             annotations.add(new AnnotationNode(ClassHelper.make("groovy.transform.Trait")));
@@ -748,7 +748,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
 
     protected void enumDef(AST enumNode) {
         assertNodeType(ENUM_DEF, enumNode);
-        List<AnnotationNode> annotations = new ArrayList<AnnotationNode>();
+        List<AnnotationNode> annotations = new ArrayList<>();
 
         AST node = enumNode.getFirstChild();
         int modifiers = Opcodes.ACC_PUBLIC;
@@ -782,7 +782,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
     protected void enumConstantDef(AST node) {
         enumConstantBeingDef = true;
         assertNodeType(ENUM_CONSTANT_DEF, node);
-        List<AnnotationNode> annotations = new ArrayList<AnnotationNode>();
+        List<AnnotationNode> annotations = new ArrayList<>();
         AST element = node.getFirstChild();
         if (isType(ANNOTATIONS, element)) {
             processAnnotations(annotations, element);
@@ -859,7 +859,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
 
     protected void methodDef(AST methodDef) {
         MethodNode oldNode = methodNode;
-        List<AnnotationNode> annotations = new ArrayList<AnnotationNode>();
+        List<AnnotationNode> annotations = new ArrayList<>();
         AST node = methodDef.getFirstChild();
 
         GenericsType[] generics = null;
@@ -908,7 +908,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
 
             if (isType(LITERAL_throws, node)) {
                 AST throwsNode = node.getFirstChild();
-                List<ClassNode> exceptionList = new ArrayList<ClassNode>();
+                List<ClassNode> exceptionList = new ArrayList<>();
                 throwsList(throwsNode, exceptionList);
                 exceptions = exceptionList.toArray(exceptions);
                 node = node.getNextSibling();
@@ -970,7 +970,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
     }
 
     protected void constructorDef(AST constructorDef) {
-        List<AnnotationNode> annotations = new ArrayList<AnnotationNode>();
+        List<AnnotationNode> annotations = new ArrayList<>();
         AST node = constructorDef.getFirstChild();
         int modifiers = Opcodes.ACC_PUBLIC;
         if (isType(MODIFIERS, node)) {
@@ -990,7 +990,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
         ClassNode[] exceptions = ClassNode.EMPTY_ARRAY;
         if (isType(LITERAL_throws, node)) {
             AST throwsNode = node.getFirstChild();
-            List<ClassNode> exceptionList = new ArrayList<ClassNode>();
+            List<ClassNode> exceptionList = new ArrayList<>();
             throwsList(throwsNode, exceptionList);
             exceptions = exceptionList.toArray(exceptions);
             node = node.getNextSibling();
@@ -1011,7 +1011,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
     }
 
     protected void fieldDef(AST fieldDef) {
-        List<AnnotationNode> annotations = new ArrayList<AnnotationNode>();
+        List<AnnotationNode> annotations = new ArrayList<>();
         AST node = fieldDef.getFirstChild();
 
         int modifiers = 0;
@@ -1101,7 +1101,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
     }
 
     protected ClassNode[] interfaces(AST node) {
-        List<ClassNode> interfaceList = new ArrayList<ClassNode>();
+        List<ClassNode> interfaceList = new ArrayList<>();
         for (AST implementNode = node.getFirstChild(); implementNode != null; implementNode
= implementNode.getNextSibling()) {
             interfaceList.add(makeTypeWithArguments(implementNode));
         }
@@ -1121,7 +1121,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
             if (isType(IMPLICIT_PARAMETERS, parametersNode)) return Parameter.EMPTY_ARRAY;
             return null;
         } else {
-            List<Parameter> parameters = new ArrayList<Parameter>();
+            List<Parameter> parameters = new ArrayList<>();
             AST firstParameterNode = null;
             do {
                 firstParam = (firstParameterNode == null);
@@ -1149,7 +1149,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
     }
 
     protected Parameter parameter(AST paramNode) {
-        List<AnnotationNode> annotations = new ArrayList<AnnotationNode>();
+        List<AnnotationNode> annotations = new ArrayList<>();
         boolean variableParameterDef = isType(VARIABLE_PARAMETER_DEF, paramNode);
         AST node = paramNode.getFirstChild();
 
@@ -1463,7 +1463,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
                 AST node = variableNode.getFirstChild();
                 // skip the final modifier if it's present
                 if (isType(MODIFIERS, node)) {
-                    int modifiersMask = modifiers(node, new ArrayList<AnnotationNode>(),
0);
+                    int modifiersMask = modifiers(node, new ArrayList<>(), 0);
                     // only final modifier allowed
                     if ((modifiersMask & ~Opcodes.ACC_FINAL) != 0) {
                         throw new ASTRuntimeException(node, "Only the 'final' modifier is
allowed in front of the for loop variable.");
@@ -1529,7 +1529,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
     protected Expression declarationExpression(AST variableDef) {
         AST node = variableDef.getFirstChild();
         ClassNode type = null;
-        List<AnnotationNode> annotations = new ArrayList<AnnotationNode>();
+        List<AnnotationNode> annotations = new ArrayList<>();
         int modifiers = 0;
         if (isType(MODIFIERS, node)) {
             // force check of modifier conflicts
@@ -1635,7 +1635,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
     }
 
     protected Statement caseStatements(AST node, List cases) {
-        List<Expression> expressions = new LinkedList<Expression>();
+        List<Expression> expressions = new LinkedList<>();
         Statement statement = EmptyStatement.INSTANCE;
         Statement defaultStatement = EmptyStatement.INSTANCE;
         AST nextSibling = node;
@@ -1696,7 +1696,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
         AST node = tryNode.getNextSibling();
 
         // let's do the catch nodes
-        List<CatchStatement> catches = new ArrayList<CatchStatement>();
+        List<CatchStatement> catches = new ArrayList<>();
         for (; isType(LITERAL_catch, node); node = node.getNextSibling()) {
             final List<CatchStatement> catchStatements = catchStatement(node);
             catches.addAll(catchStatements);
@@ -1721,7 +1721,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
 
     protected List<CatchStatement> catchStatement(AST catchNode) {
         AST node = catchNode.getFirstChild();
-        List<CatchStatement> catches = new LinkedList<CatchStatement>();
+        List<CatchStatement> catches = new LinkedList<>();
         if (MULTICATCH == node.getType()) {
             final AST multicatches = node.getFirstChild();
             if (multicatches.getType() != MULTICATCH_TYPES) {
@@ -2125,7 +2125,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
     private ClosureListExpression closureListExpression(AST node) {
         isClosureListExpressionAllowedHere(node);
         AST exprNode = node.getFirstChild();
-        List<Expression> list = new LinkedList<Expression>();
+        List<Expression> list = new LinkedList<>();
         while (exprNode != null) {
             if (isType(EXPR, exprNode)) {
                 Expression expr = expression(exprNode);
@@ -2243,7 +2243,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
 */
 
     protected Expression listExpression(AST listNode) {
-        List<Expression> expressions = new ArrayList<Expression>();
+        List<Expression> expressions = new ArrayList<>();
         AST elist = listNode.getFirstChild();
         assertNodeType(ELIST, elist);
 
@@ -2667,7 +2667,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
     }
 
     protected Expression enumArguments(AST elist) {
-        List<Expression> expressionList = new ArrayList<Expression>();
+        List<Expression> expressionList = new ArrayList<>();
         for (AST node = elist; node != null; node = node.getNextSibling()) {
             Expression expression = expression(node);
             expressionList.add(expression);
@@ -2695,7 +2695,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
                 // let's remove any non-MapEntryExpression instances
                 // such as if the last expression is a ClosureExpression
                 // so let's wrap the named method calls in a Map expression
-                List<Expression> argumentList = new ArrayList<Expression>();
+                List<Expression> argumentList = new ArrayList<>();
                 for (Object next : expressionList) {
                     Expression expression = (Expression) next;
                     if (!(expression instanceof MapEntryExpression)) {
@@ -2727,7 +2727,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
     private static void checkDuplicateNamedParams(AST elist, List expressionList) {
         if (expressionList.isEmpty()) return;
 
-        Set<String> namedArgumentNames = new HashSet<String>();
+        Set<String> namedArgumentNames = new HashSet<>();
         for (Object expression : expressionList) {
             MapEntryExpression meExp = (MapEntryExpression) expression;
             if (meExp.getKeyExpression() instanceof ConstantExpression) {
@@ -2758,7 +2758,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
     }
 
     protected Expression expressionList(AST node) {
-        List<Expression> expressionList = new ArrayList<Expression>();
+        List<Expression> expressionList = new ArrayList<>();
         for (AST child = node.getFirstChild(); child != null; child = child.getNextSibling())
{
             expressionList.add(expression(child));
         }
@@ -3000,7 +3000,7 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin,
Groovy
 
     private List<GenericsType> getTypeArgumentsList(AST node) {
         assertNodeType(TYPE_ARGUMENTS, node);
-        List<GenericsType> typeArgumentList = new LinkedList<GenericsType>();
+        List<GenericsType> typeArgumentList = new LinkedList<>();
         AST typeArgument = node.getFirstChild();
 
         while (typeArgument != null) {
diff --git a/src/main/java/org/codehaus/groovy/ast/AnnotationNode.java b/src/main/java/org/codehaus/groovy/ast/AnnotationNode.java
index cb493cc..1b8f9fa 100644
--- a/src/main/java/org/codehaus/groovy/ast/AnnotationNode.java
+++ b/src/main/java/org/codehaus/groovy/ast/AnnotationNode.java
@@ -72,7 +72,7 @@ public class AnnotationNode extends ASTNode {
 
     private void assertMembers() {
         if (members == null) {
-             members = new LinkedHashMap<String, Expression>();
+             members = new LinkedHashMap<>();
         }
     }
 
diff --git a/src/main/java/org/codehaus/groovy/ast/builder/AstBuilderTransformation.java b/src/main/java/org/codehaus/groovy/ast/builder/AstBuilderTransformation.java
index 8ee6bac..be192f7 100644
--- a/src/main/java/org/codehaus/groovy/ast/builder/AstBuilderTransformation.java
+++ b/src/main/java/org/codehaus/groovy/ast/builder/AstBuilderTransformation.java
@@ -69,7 +69,7 @@ public class AstBuilderTransformation extends MethodCallTransformation {
      */
     private static class AstBuilderInvocationTrap extends MethodInvocationTrap {
 
-        private final List<String> factoryTargets = new ArrayList<String>();
+        private final List<String> factoryTargets = new ArrayList<>();
 
         /**
          * Creates the trap and captures all the ways in which a class may be referenced
via imports.
@@ -121,7 +121,7 @@ public class AstBuilderTransformation extends MethodCallTransformation
{
         }
 
         private static List<Expression> getNonClosureArguments(MethodCallExpression
call) {
-            List<Expression> result = new ArrayList<Expression>();
+            List<Expression> result = new ArrayList<>();
             if (call.getArguments() instanceof TupleExpression) {
                 for (ASTNode node : ((TupleExpression) call.getArguments()).getExpressions())
{
                     if (!(node instanceof ClosureExpression)) {
diff --git a/src/main/java/org/codehaus/groovy/ast/decompiled/ClassStub.java b/src/main/java/org/codehaus/groovy/ast/decompiled/ClassStub.java
index 96df728..2c99fe1 100644
--- a/src/main/java/org/codehaus/groovy/ast/decompiled/ClassStub.java
+++ b/src/main/java/org/codehaus/groovy/ast/decompiled/ClassStub.java
@@ -99,7 +99,7 @@ class FieldStub extends MemberStub {
 
 class AnnotationStub {
     final String className;
-    final Map<String, Object> members = new LinkedHashMap<String, Object>();
+    final Map<String, Object> members = new LinkedHashMap<>();
 
     public AnnotationStub(String className) {
         this.className = className;
diff --git a/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java b/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
index 61b6346..bf46031 100644
--- a/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
+++ b/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
@@ -165,7 +165,7 @@ public class AsmClassGenerator extends ClassGenerator {
     static final MethodCaller createGroovyObjectWrapperMethod = MethodCaller.newStatic(ScriptBytecodeAdapter.class,
"createGroovyObjectWrapper");
 
     // exception blocks list
-    private final Map<String,ClassNode> referencedClasses = new HashMap<String,ClassNode>();
+    private final Map<String,ClassNode> referencedClasses = new HashMap<>();
     private boolean passingParams;
 
     public static final boolean CREATE_DEBUG_INFO = true;
@@ -2093,10 +2093,10 @@ public class AsmClassGenerator extends ClassGenerator {
      * @param av the visitor to use
      */
     private void visitAnnotationAttributes(AnnotationNode an, AnnotationVisitor av) {
-        Map<String, Object> constantAttrs = new HashMap<String, Object>();
-        Map<String, PropertyExpression> enumAttrs = new HashMap<String, PropertyExpression>();
-        Map<String, Object> atAttrs = new HashMap<String, Object>();
-        Map<String, ListExpression> arrayAttrs = new HashMap<String, ListExpression>();
+        Map<String, Object> constantAttrs = new HashMap<>();
+        Map<String, PropertyExpression> enumAttrs = new HashMap<>();
+        Map<String, Object> atAttrs = new HashMap<>();
+        Map<String, ListExpression> arrayAttrs = new HashMap<>();
 
         for (String name : an.getMembers().keySet()) {
             Expression expr = an.getMember(name);
diff --git a/src/main/java/org/codehaus/groovy/runtime/metaclass/ConcurrentReaderHashMap.java
b/src/main/java/org/codehaus/groovy/runtime/metaclass/ConcurrentReaderHashMap.java
index 86277db..1337b77 100644
--- a/src/main/java/org/codehaus/groovy/runtime/metaclass/ConcurrentReaderHashMap.java
+++ b/src/main/java/org/codehaus/groovy/runtime/metaclass/ConcurrentReaderHashMap.java
@@ -866,12 +866,12 @@ public class ConcurrentReaderHashMap
     }
     public Object[] toArray() {
       Collection c = new ArrayList();
-        for (Object o : this) c.add(o);
+        c.addAll(this);
       return c.toArray();
     }
     public Object[] toArray(Object[] a) {
       Collection c = new ArrayList();
-        for (Object o : this) c.add(o);
+      c.addAll(this);
       return c.toArray(a);
     }
   }
@@ -907,12 +907,12 @@ public class ConcurrentReaderHashMap
     }
     public Object[] toArray() {
       Collection c = new ArrayList();
-        for (Object o : this) c.add(o);
+      c.addAll(this);
       return c.toArray();
     }
     public Object[] toArray(Object[] a) {
       Collection c = new ArrayList();
-        for (Object o : this) c.add(o);
+      c.addAll(this);
       return c.toArray(a);
     }
   }
@@ -958,12 +958,12 @@ public class ConcurrentReaderHashMap
     }
     public Object[] toArray() {
       Collection c = new ArrayList();
-        for (Object o : this) c.add(o);
+      c.addAll(this);
       return c.toArray();
     }
     public Object[] toArray(Object[] a) {
       Collection c = new ArrayList();
-        for (Object o : this) c.add(o);
+      c.addAll(this);
       return c.toArray(a);
     }
   }
diff --git a/src/main/java/org/codehaus/groovy/transform/AbstractASTTransformation.java b/src/main/java/org/codehaus/groovy/transform/AbstractASTTransformation.java
index 4fc13d2..bfe25e3 100644
--- a/src/main/java/org/codehaus/groovy/transform/AbstractASTTransformation.java
+++ b/src/main/java/org/codehaus/groovy/transform/AbstractASTTransformation.java
@@ -67,8 +67,8 @@ public abstract class AbstractASTTransformation implements Opcodes, ASTTransform
      * Annotations with {@link org.codehaus.groovy.runtime.GeneratedClosure} members are
not supported for now.
      */
     protected List<AnnotationNode> copyAnnotatedNodeAnnotations(final AnnotatedNode
annotatedNode, String myTypeName) {
-        final List<AnnotationNode> copiedAnnotations = new ArrayList<AnnotationNode>();
-        final List<AnnotationNode> notCopied = new ArrayList<AnnotationNode>();
+        final List<AnnotationNode> copiedAnnotations = new ArrayList<>();
+        final List<AnnotationNode> notCopied = new ArrayList<>();
         GeneralUtils.copyAnnotatedNodeAnnotations(annotatedNode, copiedAnnotations, notCopied);
         for (AnnotationNode annotation : notCopied) {
             addError(myTypeName + " does not support keeping Closure annotation members.",
annotation);
@@ -188,7 +188,7 @@ public abstract class AbstractASTTransformation implements Opcodes, ASTTransform
     }
 
     private static List<String> getValueStringList(ListExpression listExpression) {
-        List<String> list = new ArrayList<String>();
+        List<String> list = new ArrayList<>();
         for (Expression itemExpr : listExpression.getExpressions()) {
             if (itemExpr instanceof ConstantExpression) {
                 Object value = ((ConstantExpression) itemExpr).getValue();
@@ -213,7 +213,7 @@ public abstract class AbstractASTTransformation implements Opcodes, ASTTransform
     }
 
     public List<ClassNode> getMemberClassList(AnnotationNode anno, String name) {
-        List<ClassNode> list = new ArrayList<ClassNode>();
+        List<ClassNode> list = new ArrayList<>();
         Expression expr = anno.getMember(name);
         if (expr == null) {
             return null;
@@ -233,7 +233,7 @@ public abstract class AbstractASTTransformation implements Opcodes, ASTTransform
     }
 
     private static List<ClassNode> getTypeList(ListExpression listExpression) {
-        List<ClassNode> list = new ArrayList<ClassNode>();
+        List<ClassNode> list = new ArrayList<>();
         for (Expression itemExpr : listExpression.getExpressions()) {
             if (itemExpr instanceof ClassExpression) {
                 ClassNode cn = itemExpr.getType();
@@ -265,7 +265,7 @@ public abstract class AbstractASTTransformation implements Opcodes, ASTTransform
     }
 
     public static List<String> tokenize(String rawExcludes) {
-        return rawExcludes == null ? new ArrayList<String>() : StringGroovyMethods.tokenize(rawExcludes,
", ");
+        return rawExcludes == null ? new ArrayList<>() : StringGroovyMethods.tokenize(rawExcludes,
", ");
     }
 
     public static boolean deemedInternalName(String name) {
@@ -349,7 +349,7 @@ public abstract class AbstractASTTransformation implements Opcodes, ASTTransform
         String descriptorNoReturn = MethodNodeUtils.methodDescriptorWithoutReturnType(mNode);
         if (excludeTypes != null) {
             for (ClassNode cn : excludeTypes) {
-                List<ClassNode> remaining = new LinkedList<ClassNode>();
+                List<ClassNode> remaining = new LinkedList<>();
                 remaining.add(cn);
                 Map updatedGenericsSpec = new HashMap(genericsSpec);
                 while (!remaining.isEmpty()) {
@@ -373,7 +373,7 @@ public abstract class AbstractASTTransformation implements Opcodes, ASTTransform
         }
         if (includeTypes == null) return false;
         for (ClassNode cn : includeTypes) {
-            List<ClassNode> remaining = new LinkedList<ClassNode>();
+            List<ClassNode> remaining = new LinkedList<>();
             remaining.add(cn);
             Map updatedGenericsSpec = new HashMap(genericsSpec);
             while (!remaining.isEmpty()) {
@@ -450,13 +450,13 @@ public abstract class AbstractASTTransformation implements Opcodes,
ASTTransform
         if (propertyNameList == null || propertyNameList.isEmpty()) {
             return true;
         }
-        final List<String> pNames = new ArrayList<String>();
+        final List<String> pNames = new ArrayList<>();
         for (PropertyNode pNode : BeanUtils.getAllProperties(cNode, includeSuperProperties,
includeStatic, allProperties)) {
             pNames.add(pNode.getField().getName());
         }
         boolean result = true;
         if (includeFields || includeSuperFields) {
-            final List<String> fNames = new ArrayList<String>();
+            final List<String> fNames = new ArrayList<>();
             if (includeFields) {
                 fNames.addAll(getInstanceNonPropertyFieldNames(cNode));
             }
diff --git a/src/main/java/org/codehaus/groovy/transform/stc/AbstractTypeCheckingExtension.java
b/src/main/java/org/codehaus/groovy/transform/stc/AbstractTypeCheckingExtension.java
index 3248711..87d3952 100644
--- a/src/main/java/org/codehaus/groovy/transform/stc/AbstractTypeCheckingExtension.java
+++ b/src/main/java/org/codehaus/groovy/transform/stc/AbstractTypeCheckingExtension.java
@@ -59,8 +59,8 @@ import java.util.logging.Logger;
 public class AbstractTypeCheckingExtension extends TypeCheckingExtension {
     private static final Logger LOG = Logger.getLogger(GroovyTypeCheckingExtensionSupport.class.getName());
     protected final TypeCheckingContext context;
-    private final Set<MethodNode> generatedMethods = new LinkedHashSet<MethodNode>();
-    private final LinkedList<TypeCheckingScope> scopeData = new LinkedList<TypeCheckingScope>();
+    private final Set<MethodNode> generatedMethods = new LinkedHashSet<>();
+    private final LinkedList<TypeCheckingScope> scopeData = new LinkedList<>();
     // this boolean is used through setHandled(boolean)
     protected boolean handled = false;
     protected boolean debug = false;


Mime
View raw message