[
https://issues.apache.org/jira/browse/GROOVY-10035?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Sun updated GROOVY-10035:
--------------------------------
Summary: Eliminate redundant type cast (was: CLONE - Compiler writes extra
cast for Type[] to Object[])
> Eliminate redundant type cast
> -----------------------------
>
> Key: GROOVY-10035
> URL: https://issues.apache.org/jira/browse/GROOVY-10035
> Project: Groovy
> Issue Type: Improvement
> Components: bytecode
> Reporter: Eric Milles
> Priority: Minor
> Time Spent: 10m
> Remaining Estimate: 0h
>
> The ticket is to provide some suggestion to tweak the fix of GROOVY-10034
> 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#L342-L345]
> {code:java}
> if (targetType.isArray() &&
> targetType.getComponentType().equals(ClassHelper.OBJECT_TYPE)
> && top.isArray() &&
> !ClassHelper.isPrimitiveType(top.getComponentType())) {
> return;
> }
> {code}
> tweaked as:
> {code:java}
> // https://github.com/apache/groovy/pull/1561
> if (ClassNodeUtils.isCompatibleWith(top, targetType)) return;
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)