groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-6631) Static compilation fails around byte arrays
Date Thu, 17 May 2018 06:18:00 GMT

    [ https://issues.apache.org/jira/browse/GROOVY-6631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16478594#comment-16478594
] 

Paul King commented on GROOVY-6631:
-----------------------------------

I'd probably just use {{intdiv}} here, e.g.: {{data[i.intdiv(2)]}}.

> Static compilation fails around byte arrays
> -------------------------------------------
>
>                 Key: GROOVY-6631
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6631
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.3.0, 2.4.0-rc-1
>            Reporter: Dimitar Dimitrov
>            Assignee: Daniel Sun
>            Priority: Major
>
> {code}
> @groovy.transform.CompileStatic
> class Test {
>     byte[] parseStructuredString(String s) {
>         byte[] data = new byte[s.length() / 2];
>         for (int i = 0; i < s.length(); i += 2) {
>             data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i+1),
16));
>         }
>         return data
>     }
> }
> {code}
> Error:(11, 13) Groovyc: [Static type checking] - Cannot find matching method [B#getAt(java.math.BigDecimal).
Please check if the declared type is right and if the method exists.
> Error:(11, 27) Groovyc: [Static type checking] - Cannot assign value of type byte to
variable of type byte[]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message