daniellansun commented on code in PR #2245: URL: https://github.com/apache/groovy/pull/2245#discussion_r2119123343
########## src/main/java/org/codehaus/groovy/transform/DelegateASTTransformation.java: ########## @@ -215,7 +220,11 @@ public void visit(final ASTNode[] nodes, final SourceUnit source) { } private static Collection<MethodNode> collectMethods(final ClassNode type) { - List<MethodNode> methods = new java.util.LinkedList<>(getAllMethods(type)); + List<MethodNode> allMethods = new ArrayList<>(getAllMethods(type)); + if (!allMethods.isEmpty()) { + allMethods.sort(Comparator.comparing(MethodNodeUtils::methodDescriptorWithoutReturnType)); + } + List<MethodNode> methods = new java.util.LinkedList<>(allMethods); Review Comment: Why should we create `java.util.LinkedList` instance here? We have a sorted `allMethods` already, maybe we could rename `allMethods` to `methods`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@groovy.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org