You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/07/06 18:34:00 UTC

[jira] [Assigned] (GROOVY-9206) Cannot use annotation with attribute of type char

     [ https://issues.apache.org/jira/browse/GROOVY-9206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles reassigned GROOVY-9206:
-----------------------------------

    Assignee: Eric Milles

> Cannot use annotation with attribute of type char
> -------------------------------------------------
>
>                 Key: GROOVY-9206
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9206
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>              Labels: annotations
>
> Consider the following:
> {code:groovy}
> import java.lang.annotation.*;
> @Target(ElementType.FIELD)
> public @interface A {
>   char value();
> }
> ​class C {
>   @A((char)';')
>   String tokens
> }
> {code}
> This errors with: {{Expected '(char) ;' to be an inline constant of type char in @A}}.  I've tried a bare 1-character string literal, coercion, an int literal, and assignment to a static final field/property with similar results.  Not sure if it is possible to use this annotation without some kind of fix.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)