[ https://issues.apache.org/jira/browse/GROOVY-11581?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Wilson Leung updated GROOVY-11581: ---------------------------------- Description: {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. was: {code:java} class Foo { void test() { def byteArr = 'FOO'.bytes new NestedFoo().printClass byteArr } static bar(val, apple) { println "bar class: ${val.getClass()}" } static baz(val) { println "baz class: ${val.getClass()}" } 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. > 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 > Priority: Minor > > > {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)