groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <blackd...@gmx.org>
Subject Re: Unexpected byte[] parameter conversion when calling java method
Date Fri, 20 Oct 2017 15:03:07 GMT


Am 20.10.2017 um 09:51 schrieb Michael Kunz:
> Hello,
>
> I'm having problems calling a Java method call(byte[]... data) from
> groovy 2.4.12.
> I'm trying to call it with a single byte[] value from groovy like this:
> byte[] data = [0,1,2,3,4,5,6,7]
> TestJava.call(data)
>
> I was expecting to receive a byte[][] data = {{0,1,2,3,4,5,6,7}} in Java
> but instead have a split array of the form byte[][] data =
> {{0},{1},{2},{3},{4},{5},{6},{7}} which doesn't make sense to me.
> A full example is available at
> https://gist.github.com/protogenes/93a5d76075b45ba5a946034820f03c76
>
> What is the expected behaviour and why? Can I change the Java method
> signature in a way so that the arrays are preserved?

the expected behavior is what you expect {{0,1,2,3,4,5,6,7}}

bye Jochen


Mime
View raw message