groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Sadedin <ssade...@gmail.com>
Subject Re: Byte literal
Date Wed, 15 Jan 2020 22:13:43 GMT
>I'm getting the following error:
>
> Error:Groovyc: Attribute 'value' should have type 'java.lang.Byte'; but
found type 'java.lang.Integer' in @Version

I have a similar type of problem where I cannot find any way to invoke
Arrays.fill() for the byte version  - even with explicit workarounds that
should ensure a primitive byte is passed, for example:

        def result = new byte[10][10]
        final Byte minusOne = -1
        for(int i=0; i<10; ++i) {
            Arrays.fill(result, 0, dim, minusOne.byteValue())
        }

It happens with and without CompileStatic and results in:

java.lang.ArrayStoreException: java.lang.Byte
at java.util.Arrays.fill(Arrays.java:3155)

For these kind of cases  I'm left having to create little Java stub
workarounds to get it to call the right underlying Java API.

Would be nice to have at least a way to work around this!

Cheers,

Simon

Mime
View raw message