[ https://issues.apache.org/jira/browse/GROOVY-11581?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-11581. ------------------------------ > byte array casted to array list when calling parent method from nested class > ---------------------------------------------------------------------------- > > Key: GROOVY-11581 > URL: https://issues.apache.org/jira/browse/GROOVY-11581 > Project: Groovy > Issue Type: Bug > Affects Versions: 4.0.9, 4.0.26 > Reporter: Wilson Leung > Assignee: Eric Milles > Priority: Minor > Fix For: 5.0.0-beta-1, 3.0.25, 4.0.27 > > > > {code:java} > class Foo { > void test() { > def byteArr = 'FOO'.bytes > new NestedFoo().printClass byteArr > } > > static bar(val, apple) { > println "bar class: ${val.getClass()}" // prints array list > } > > static baz(val) { > println "baz class: ${val.getClass()}" // prints byte array > } > static class NestedFoo { > def printClass(val) { > println "nestedFoo class: ${val.getClass()}" > bar val, '' > baz val > } > } > } > new Foo().test() {code} > Byte arrays are being casted to an array list when calling a parent method > from a dynamically compiled nested class. In the code above the call to bar > will cast the byte array to an array list. This does not happen in the call > to baz. It seems like this only happens when the method called takes more > than one arg. I was able to reproduce this in groovy 4.0.9, I have not tested > this in earlier versions. > To reproduce > 1) Nested class must be compiled dynamically > 2) The parent method being called must take at least two arguments. It does > not get casted when the method takes a single argument. > > > > -- This message was sent by Atlassian Jira (v8.20.10#820010)