groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [groovy] 02/05: Trivial refactoring: remove deprecated methods of `AbstractASTTransformation`
Date Sat, 26 Oct 2019 17:26:02 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit ede69393aa6c75c446355c5a83da27ecf4b10442
Author: Daniel Sun <sunlan@apache.org>
AuthorDate: Sun Oct 27 00:30:37 2019 +0800

    Trivial refactoring: remove deprecated methods of `AbstractASTTransformation`
---
 .../transform/AbstractASTTransformation.java       | 108 ---------------------
 1 file changed, 108 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/transform/AbstractASTTransformation.java b/src/main/java/org/codehaus/groovy/transform/AbstractASTTransformation.java
index 4fc13d2..9f5d71e 100644
--- a/src/main/java/org/codehaus/groovy/transform/AbstractASTTransformation.java
+++ b/src/main/java/org/codehaus/groovy/transform/AbstractASTTransformation.java
@@ -174,19 +174,6 @@ public abstract class AbstractASTTransformation implements Opcodes, ASTTransform
         return false;
     }
 
-    @Deprecated
-    public static List<String> getMemberList(AnnotationNode anno, String name) {
-        List<String> list;
-        Expression expr = anno.getMember(name);
-        if (expr instanceof ListExpression) {
-            final ListExpression listExpression = (ListExpression) expr;
-            list = getValueStringList(listExpression);
-        } else {
-            list = tokenize(getMemberStringValue(anno, name));
-        }
-        return list;
-    }
-
     private static List<String> getValueStringList(ListExpression listExpression) {
         List<String> list = new ArrayList<String>();
         for (Expression itemExpr : listExpression.getExpressions()) {
@@ -198,20 +185,6 @@ public abstract class AbstractASTTransformation implements Opcodes, ASTTransform
         return list;
     }
 
-    @Deprecated
-    public List<ClassNode> getClassList(AnnotationNode anno, String name) {
-        List<ClassNode> list = new ArrayList<ClassNode>();
-        Expression expr = anno.getMember(name);
-        if (expr instanceof ListExpression) {
-            final ListExpression listExpression = (ListExpression) expr;
-            list = getTypeList(listExpression);
-        } else if (expr instanceof ClassExpression) {
-            ClassNode cn = expr.getType();
-            if (cn != null) list.add(cn);
-        }
-        return list;
-    }
-
     public List<ClassNode> getMemberClassList(AnnotationNode anno, String name) {
         List<ClassNode> list = new ArrayList<ClassNode>();
         Expression expr = anno.getMember(name);
@@ -292,57 +265,6 @@ public abstract class AbstractASTTransformation implements Opcodes, ASTTransform
             (includes != null && !includes.isEmpty() && !includes.contains(name));
     }
 
-    @Deprecated
-    public static boolean shouldSkipOnDescriptor(boolean checkReturn, Map genericsSpec, MethodNode
mNode, List<ClassNode> excludeTypes, List<ClassNode> includeTypes) {
-        String descriptor = mNode.getTypeDescriptor();
-        String descriptorNoReturn = MethodNodeUtils.methodDescriptorWithoutReturnType(mNode);
-        for (ClassNode cn : excludeTypes) {
-            List<ClassNode> remaining = new LinkedList<ClassNode>();
-            remaining.add(cn);
-            Map updatedGenericsSpec = new HashMap(genericsSpec);
-            while (!remaining.isEmpty()) {
-                ClassNode next = remaining.remove(0);
-                if (!next.equals(ClassHelper.OBJECT_TYPE)) {
-                    updatedGenericsSpec = GenericsUtils.createGenericsSpec(next, updatedGenericsSpec);
-                    for (MethodNode mn : next.getMethods()) {
-                        MethodNode correctedMethodNode = GenericsUtils.correctToGenericsSpec(updatedGenericsSpec,
mn);
-                        if (checkReturn) {
-                            String md = correctedMethodNode.getTypeDescriptor();
-                            if (md.equals(descriptor)) return true;
-                        } else {
-                            String md = MethodNodeUtils.methodDescriptorWithoutReturnType(correctedMethodNode);
-                            if (md.equals(descriptorNoReturn)) return true;
-                        }
-                    }
-                    remaining.addAll(Arrays.asList(next.getInterfaces()));
-                }
-            }
-        }
-        if (includeTypes.isEmpty()) return false;
-        for (ClassNode cn : includeTypes) {
-            List<ClassNode> remaining = new LinkedList<ClassNode>();
-            remaining.add(cn);
-            Map updatedGenericsSpec = new HashMap(genericsSpec);
-            while (!remaining.isEmpty()) {
-                ClassNode next = remaining.remove(0);
-                if (!next.equals(ClassHelper.OBJECT_TYPE)) {
-                    updatedGenericsSpec = GenericsUtils.createGenericsSpec(next, updatedGenericsSpec);
-                    for (MethodNode mn : next.getMethods()) {
-                        MethodNode correctedMethodNode = GenericsUtils.correctToGenericsSpec(updatedGenericsSpec,
mn);
-                        if (checkReturn) {
-                            String md = correctedMethodNode.getTypeDescriptor();
-                            if (md.equals(descriptor)) return false;
-                        } else {
-                            String md = MethodNodeUtils.methodDescriptorWithoutReturnType(correctedMethodNode);
-                            if (md.equals(descriptorNoReturn)) return false;
-                        }
-                    }
-                    remaining.addAll(Arrays.asList(next.getInterfaces()));
-                }
-            }
-        }
-        return true;
-    }
     public static boolean shouldSkipOnDescriptorUndefinedAware(boolean checkReturn, Map genericsSpec,
MethodNode mNode,
                                                   List<ClassNode> excludeTypes, List<ClassNode>
includeTypes) {
         String descriptor = mNode.getTypeDescriptor();
@@ -397,15 +319,6 @@ public abstract class AbstractASTTransformation implements Opcodes, ASTTransform
         return true;
     }
 
-    @Deprecated
-    protected boolean checkIncludeExclude(AnnotationNode node, List<String> excludes,
List<String> includes, String typeName) {
-        if (includes != null && !includes.isEmpty() && excludes != null &&
!excludes.isEmpty()) {
-            addError("Error during " + typeName + " processing: Only one of 'includes' and
'excludes' should be supplied not both.", node);
-            return false;
-        }
-        return true;
-    }
-
     protected boolean checkIncludeExcludeUndefinedAware(AnnotationNode node, List<String>
excludes, List<String> includes, String typeName) {
         if (includes != null && excludes != null && !excludes.isEmpty())
{
             addError("Error during " + typeName + " processing: Only one of 'includes' and
'excludes' should be supplied not both.", node);
@@ -414,18 +327,6 @@ public abstract class AbstractASTTransformation implements Opcodes, ASTTransform
         return true;
     }
 
-    @Deprecated
-    protected void checkIncludeExclude(AnnotationNode node, List<String> excludes,
List<String> includes, List<ClassNode> excludeTypes, List<ClassNode> includeTypes,
String typeName) {
-        int found = 0;
-        if (includes != null && !includes.isEmpty()) found++;
-        if (excludes != null && !excludes.isEmpty()) found++;
-        if (includeTypes != null && !includeTypes.isEmpty()) found++;
-        if (excludeTypes != null && !excludeTypes.isEmpty()) found++;
-        if (found > 1) {
-            addError("Error during " + typeName + " processing: Only one of 'includes', 'excludes',
'includeTypes' and 'excludeTypes' should be supplied.", node);
-        }
-    }
-
     protected void checkIncludeExcludeUndefinedAware(AnnotationNode node, List<String>
excludes, List<String> includes,
                                         List<ClassNode> excludeTypes, List<ClassNode>
includeTypes, String typeName) {
         int found = 0;
@@ -482,13 +383,4 @@ public abstract class AbstractASTTransformation implements Opcodes, ASTTransform
         }
         return result;
     }
-
-    /**
-     * @deprecated use GenericsUtils#nonGeneric
-     */
-    @Deprecated
-    public static ClassNode nonGeneric(ClassNode type) {
-        return GenericsUtils.nonGeneric(type);
-    }
-
 }


Mime
View raw message