groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [groovy] 06/08: Minor refactor: remove legacy code
Date Sat, 02 Nov 2019 21:47:03 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 2861d761b7d105ac3e44358c2e8a23a8a03a8955
Author: Daniel Sun <sunlan@apache.org>
AuthorDate: Sun Nov 3 04:15:55 2019 +0800

    Minor refactor: remove legacy code
    
    (cherry picked from commit a754ceea44b02d6844cb88d9f863db350c7f4a9a)
---
 .../codehaus/groovy/reflection/ReflectionUtils.java   | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/reflection/ReflectionUtils.java b/src/main/java/org/codehaus/groovy/reflection/ReflectionUtils.java
index 64ec613..4a5fd6c 100644
--- a/src/main/java/org/codehaus/groovy/reflection/ReflectionUtils.java
+++ b/src/main/java/org/codehaus/groovy/reflection/ReflectionUtils.java
@@ -56,7 +56,11 @@ public class ReflectionUtils {
         IGNORED_PACKAGES.add("sun.reflect");
         IGNORED_PACKAGES.add("java.security");
         IGNORED_PACKAGES.add("java.lang.invoke");
+        IGNORED_PACKAGES.add("org.codehaus.groovy.vmplugin.v5");
+        IGNORED_PACKAGES.add("org.codehaus.groovy.vmplugin.v6");
         IGNORED_PACKAGES.add("org.codehaus.groovy.vmplugin.v7");
+        IGNORED_PACKAGES.add("org.codehaus.groovy.vmplugin.v8");
+        IGNORED_PACKAGES.add("org.codehaus.groovy.vmplugin.v9");
     }
 
     private static final ClassContextHelper HELPER = new ClassContextHelper();
@@ -113,19 +117,10 @@ public class ReflectionUtils {
         int depth = 0;
         try {
             Class c;
-            // this super class stuff is for Java 1.4 support only
-            // it isn't needed on a 5.0 VM
-            Class sc;
             do {
                 do {
                     c = classContext[depth++];
-                    if (c != null) {
-                        sc = c.getSuperclass();
-                    } else {
-                        sc = null;
-                    }
-                } while (classShouldBeIgnored(c, extraIgnoredPackages)
-                        || superClassShouldBeIgnored(sc));
+                } while (classShouldBeIgnored(c, extraIgnoredPackages));
             } while (c != null && matchLevel-- > 0 && depth<classContext.length);
             return c;
         } catch (Throwable t) {
@@ -213,10 +208,6 @@ public class ReflectionUtils {
         }
     }
 
-    private static boolean superClassShouldBeIgnored(Class sc) {
-        return ((sc != null) && (sc.getPackage() != null) && "org.codehaus.groovy.runtime.callsite".equals(sc.getPackage().getName()));
-    }
-
     private static boolean classShouldBeIgnored(Class c, Collection<String> extraIgnoredPackages)
{
         return ((c != null)
                 && (c.isSynthetic()


Mime
View raw message