danielsun1106 commented on a change in pull request #1556:
URL: https://github.com/apache/groovy/pull/1556#discussion_r611833145



##########
File path: src/main/java/org/codehaus/groovy/classgen/asm/OperandStack.java
##########
@@ -338,6 +338,12 @@ private void doConvertAndCast(ClassNode targetType, final 
boolean coerce) {
             return;
         }
 
+        // GROOVY-10034: no need to cast non-primitive array when target is 
"java.lang.Object[]"

Review comment:
       It seems that we could make the check simpler, we do not add extra 
checks but tweak the existing check:
   
   
https://github.com/apache/groovy/blob/master/src/main/java/org/codehaus/groovy/classgen/asm/OperandStack.java#L334
   ```java
   if (targetType == top) return;
   ```
   tweaked as:
   ```java
   if (targetType.getTypeClass().isAssignableFrom(top.getTypeClass())) return;
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to