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 2022/05/12 19:03:21 UTC
[groovy] 01/01: Avoid unnecessary guards for receiver and parameter of `final` type
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch danielsun/lab-indy-20220512
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit b87d4e436931960f3d10f02a2b017e94df6380a3
Author: Daniel Sun <su...@apache.org>
AuthorDate: Fri May 13 01:13:23 2022 +0800
Avoid unnecessary guards for receiver and parameter of `final` type
---
src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java | 9 +++++----
1 file changed, 5 insertions(+), 4 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 3301c18225..713810f68a 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java
@@ -932,11 +932,12 @@ public abstract class Selector {
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 (paramType.isPrimitive()) continue;
- //if (Modifier.isFinal(argClass.getModifiers()) && TypeHelper.argumentClassIsParameterClass(argClass,pt[i])) continue;
+ if (Modifier.isFinal(paramType.getModifiers())) {
+ // primitive types are also `final`
+ continue;
+ }
test = SAME_CLASS.
- bindTo(argClass).
+ bindTo(arg.getClass()).
asType(MethodType.methodType(boolean.class, paramType));
if (LOG_ENABLED) LOG.info("added same class check at pos " + i);
}