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 0ef495dfedab6b7846c0a1663da7242807c32fc5 Author: Daniel Sun <[email protected]> AuthorDate: Sat Aug 1 18:58:18 2020 +0800 Trivial refactoring: extract common variable (cherry picked from commit 5224f2f4d6591d00c5325427a9ef649d288d7705) --- .../groovy/classgen/asm/MethodCallerMultiAdapter.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/MethodCallerMultiAdapter.java b/src/main/java/org/codehaus/groovy/classgen/asm/MethodCallerMultiAdapter.java index 608e737..d417bbe 100644 --- a/src/main/java/org/codehaus/groovy/classgen/asm/MethodCallerMultiAdapter.java +++ b/src/main/java/org/codehaus/groovy/classgen/asm/MethodCallerMultiAdapter.java @@ -30,18 +30,20 @@ public class MethodCallerMultiAdapter { MethodCallerMultiAdapter mcma = new MethodCallerMultiAdapter(); mcma.skipSpreadSafeAndSafe = skipSpreadSafeAndSafe; if (createNArgs) { - int numberOfBaseMethods = mcma.numberOfBaseMethods(); + final int numberOfBaseMethods = mcma.numberOfBaseMethods(); mcma.methods = new MethodCaller[(MAX_ARGS + 2) * numberOfBaseMethods]; for (int i = 0; i <= MAX_ARGS; i++) { - mcma.methods[i * numberOfBaseMethods] = MethodCaller.newStatic(theClass, baseName + i); + final int idx = i * numberOfBaseMethods; + mcma.methods[idx] = MethodCaller.newStatic(theClass, baseName + i); if (skipSpreadSafeAndSafe) continue; - mcma.methods[i * numberOfBaseMethods + 1] = MethodCaller.newStatic(theClass, baseName + i + "Safe"); - mcma.methods[i * numberOfBaseMethods + 2] = MethodCaller.newStatic(theClass, baseName + i + "SpreadSafe"); + mcma.methods[idx + 1] = MethodCaller.newStatic(theClass, baseName + i + "Safe"); + mcma.methods[idx + 2] = MethodCaller.newStatic(theClass, baseName + i + "SpreadSafe"); } - mcma.methods[(MAX_ARGS + 1) * numberOfBaseMethods] = MethodCaller.newStatic(theClass, baseName + "N"); + final int idx = (MAX_ARGS + 1) * numberOfBaseMethods; + mcma.methods[idx] = MethodCaller.newStatic(theClass, baseName + "N"); if (!skipSpreadSafeAndSafe) { - mcma.methods[(MAX_ARGS + 1) * numberOfBaseMethods + 1] = MethodCaller.newStatic(theClass, baseName + "N" + "Safe"); - mcma.methods[(MAX_ARGS + 1) * numberOfBaseMethods + 2] = MethodCaller.newStatic(theClass, baseName + "N" + "SpreadSafe"); + mcma.methods[idx + 1] = MethodCaller.newStatic(theClass, baseName + "N" + "Safe"); + mcma.methods[idx + 2] = MethodCaller.newStatic(theClass, baseName + "N" + "SpreadSafe"); } } else if (!skipSpreadSafeAndSafe) {
