groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [groovy] 18/18: Trivial refactoring: avoid redundant operations on list
Date Sun, 03 Nov 2019 15:42:34 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 10096e64a1278e1520fbc9a49db441ade0e21876
Author: Daniel Sun <sunlan@apache.org>
AuthorDate: Sun Nov 3 23:33:43 2019 +0800

    Trivial refactoring: avoid redundant operations on list
    
    (cherry picked from commit db11d661940e63ee10046f8c602a2648fff214e6)
---
 src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java b/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
index 7c8390d..639dcbe 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
@@ -202,10 +202,8 @@ public class Java9 extends Java8 {
 
             // GROOVY-9081 "3) Access public members of private class", e.g. Collections.unmodifiableMap([:]).toString()
             // try to find the visible method from its superclasses
-            List<Class<?>> superclassList = findSuperclasses(theClass);
-            List<Class<?>> classList = new LinkedList<>();
-            classList.add(theClass);
-            classList.addAll(superclassList);
+            List<Class<?>> classList = findSuperclasses(theClass);
+            classList.add(0, theClass);
 
             for (Class<?> sc : classList) {
                 Optional<MetaMethod> optionalMetaMethod = getAccessibleMetaMethod(metaMethod,
params, caller, sc);


Mime
View raw message