You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2019/11/03 15:36:00 UTC

[groovy] branch master updated: Trivial refactoring: avoid redundant operations on list

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


The following commit(s) were added to refs/heads/master by this push:
     new db11d66  Trivial refactoring: avoid redundant operations on list
db11d66 is described below

commit db11d661940e63ee10046f8c602a2648fff214e6
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Nov 3 23:33:43 2019 +0800

    Trivial refactoring: avoid redundant operations on list
---
 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);