Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Consider the following:
import java.lang.annotation.*; @Target(ElementType.FIELD) public @interface A { char value(); } class C { @A((char)';') String tokens }
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.
Attachments
Issue Links
- is related to
-
GROOVY-9205 Specify primitive annotation default value using number literal with cast/coerce
- Closed
- relates to
-
GROOVY-6025 Using short, byte, char annotation definition attribute constants should be supported
- Closed
-
GROOVY-7252 Integer literal not accepted for primitive short annotation attribute
- Closed
-
GROOVY-9366 Unable represent literal byte costant
- Closed
-
GROOVY-10068 Cannot compile when set short value to annotation by already defined short variable since version 2.5.4
- Closed