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 2020/04/16 15:09:35 UTC
[groovy] 02/03: Trivial refactoring: extract common variable
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 f73449605bb7ba0e25339d6a69f7b65fecc260fd
Author: Daniel Sun <su...@apache.org>
AuthorDate: Thu Apr 16 19:04:53 2020 +0800
Trivial refactoring: extract common variable
(cherry picked from commit 27bac45a4392abbe7cd2520c3d0a0669df946f08)
---
src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java b/src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java
index 6741689..f0761e1 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java
@@ -930,17 +930,19 @@ public abstract class Selector {
Class<?>[] pt = handle.type().parameterArray();
for (int i = 0; i < args.length; i++) {
Object arg = args[i];
+ Class<?> paramType = pt[i];
MethodHandle test;
+
if (arg == null) {
- test = IS_NULL.asType(MethodType.methodType(boolean.class, pt[i]));
+ test = IS_NULL.asType(MethodType.methodType(boolean.class, paramType));
if (LOG_ENABLED) LOG.info("added null argument check at pos " + i);
} else {
Class<?> argClass = arg.getClass();
- if (pt[i].isPrimitive()) continue;
+ if (paramType.isPrimitive()) continue;
//if (Modifier.isFinal(argClass.getModifiers()) && TypeHelper.argumentClassIsParameterClass(argClass,pt[i])) continue;
test = SAME_CLASS.
bindTo(argClass).
- asType(MethodType.methodType(boolean.class, pt[i]));
+ asType(MethodType.methodType(boolean.class, paramType));
if (LOG_ENABLED) LOG.info("added same class check at pos " + i);
}
Class<?>[] drops = new Class[i];