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:54:34 UTC
[groovy] branch GROOVY_4_0_X updated: 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 GROOVY_4_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/GROOVY_4_0_X by this push:
new eef3d30f3f Avoid unnecessary guards for receiver and parameter of `final` type
eef3d30f3f is described below
commit eef3d30f3f808b39bce59ef17ac35b8418bdf98d
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
(cherry picked from commit ee12bb52381e8f0583c61fc25d43de1f55b80a87)
---
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);
}