Skip to content
Permalink
Browse files
Avoid unnecessary guards for receiver and parameter of final type
  • Loading branch information
daniellansun committed May 12, 2022
1 parent c251218 commit ee12bb52381e8f0583c61fc25d43de1f55b80a87
Showing 1 changed file with 5 additions and 4 deletions.
@@ -932,11 +932,12 @@ public void setGuards(Object receiver) {
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);
}

0 comments on commit ee12bb5

Please sign in to comment.