From commits-return-5430-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Thu Feb 8 02:23:20 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 2E53118065B for ; Thu, 8 Feb 2018 02:23:20 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 1E6E0160C5E; Thu, 8 Feb 2018 01:23:20 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 669D7160C5B for ; Thu, 8 Feb 2018 02:23:19 +0100 (CET) Received: (qmail 92342 invoked by uid 500); 8 Feb 2018 01:23:18 -0000 Mailing-List: contact commits-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list commits@groovy.apache.org Received: (qmail 92333 invoked by uid 99); 8 Feb 2018 01:23:18 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Feb 2018 01:23:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 743A4DFF80; Thu, 8 Feb 2018 01:23:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sunlan@apache.org To: commits@groovy.apache.org Date: Thu, 08 Feb 2018 01:23:18 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/3] groovy git commit: Trivial refactoring: Refine `getMethodDescriptor` Repository: groovy Updated Branches: refs/heads/GROOVY_2_5_X e73863dfa -> b8c7366c1 Trivial refactoring: Refine `getMethodDescriptor` (cherry picked from commit 7c4aebb) (cherry picked from commit c102ce3) Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/afc9caed Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/afc9caed Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/afc9caed Branch: refs/heads/GROOVY_2_5_X Commit: afc9caed3237295dea0e920193b9a87aa931fb1c Parents: e73863d Author: sunlan Authored: Thu Feb 8 07:37:39 2018 +0800 Committer: sunlan Committed: Thu Feb 8 09:22:35 2018 +0800 ---------------------------------------------------------------------- .../codehaus/groovy/classgen/asm/BytecodeHelper.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/afc9caed/src/main/java/org/codehaus/groovy/classgen/asm/BytecodeHelper.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/BytecodeHelper.java b/src/main/java/org/codehaus/groovy/classgen/asm/BytecodeHelper.java index af464f4..197ac9c 100644 --- a/src/main/java/org/codehaus/groovy/classgen/asm/BytecodeHelper.java +++ b/src/main/java/org/codehaus/groovy/classgen/asm/BytecodeHelper.java @@ -75,9 +75,10 @@ public class BytecodeHelper implements Opcodes { } public static String getMethodDescriptor(ClassNode returnType, Parameter[] parameters) { - StringBuilder buffer = new StringBuilder("("); - for (int i = 0; i < parameters.length; i++) { - buffer.append(getTypeDescription(parameters[i].getType())); + StringBuilder buffer = new StringBuilder(100); + buffer.append("("); + for (Parameter parameter : parameters) { + buffer.append(getTypeDescription(parameter.getType())); } buffer.append(")"); buffer.append(getTypeDescription(returnType)); @@ -99,9 +100,10 @@ public class BytecodeHelper implements Opcodes { */ public static String getMethodDescriptor(Class returnType, Class[] paramTypes) { // lets avoid class loading - StringBuilder buffer = new StringBuilder("("); - for (int i = 0; i < paramTypes.length; i++) { - buffer.append(getTypeDescription(paramTypes[i])); + StringBuilder buffer = new StringBuilder(100); + buffer.append("("); + for (Class paramType : paramTypes) { + buffer.append(getTypeDescription(paramType)); } buffer.append(")"); buffer.append(getTypeDescription(returnType));