groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [1/3] groovy git commit: Trivial refactoring: Refine `getMethodDescriptor`
Date Thu, 08 Feb 2018 01:23:18 GMT
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 <sunlan@apache.org>
Authored: Thu Feb 8 07:37:39 2018 +0800
Committer: sunlan <sunlan@apache.org>
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));


Mime
View raw message