[
https://issues.apache.org/jira/browse/GROOVY-9366?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles resolved GROOVY-9366.
---------------------------------
Fix Version/s: 5.0.0-alpha-1
Resolution: Fixed
https://github.com/apache/groovy/commit/5fe6fbc7dfef4df52fff6cf96a95b6d46d4fbf3c
> Unable represent literal byte costant
> -------------------------------------
>
> Key: GROOVY-9366
> URL: https://issues.apache.org/jira/browse/GROOVY-9366
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 2.5.9
> Reporter: paolo di tommaso
> Assignee: Eric Milles
> Priority: Major
> Labels: annotations
> Fix For: 5.0.0-alpha-1
>
>
> Groovy does not allow the definition of literal byte constants. This makes
> impossible to express byte constant in some use cases.
> First example:
> {code:java}
> public @interface Version {
> byte value();
> }
> class Foo {
> @Version(0x01) String bar
> }
> Error: Attribute 'value' should have type 'java.lang.Byte'; but found type
> 'int' in @Version
> {code}
>
> Second example:
> {code:java}
> public @interface Version {
> byte value();
> }
> class Foo {
> @Version(1 as byte) String bar
> }
> Expected '(byte) 1' to be an inline constant of type byte in @Version
> at line: 6, column: 14Attribute 'value' should have type 'java.lang.Byte';
> but found type 'java.lang.Object' in @Version
> at line: -1, column: -1 {code}
>
> Third example:
> {code:java}
> public @interface Version {
> byte value();
> }
> class Foo {
> public static final byte ONE = 0b01
> @Version(ONE) String bar
> }
> Expected 'ONE' to be an inline constant of type byte not a field expression
> in @Version
> at line: 7, column: 12Attribute 'value' should have type 'java.lang.Byte';
> but found type 'java.lang.Object' in @Version
> at line: -1, column: -1
> {code}
>
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)