You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "paolo di tommaso (Jira)" <ji...@apache.org> on 2020/01/16 12:47:00 UTC
[jira] [Created] (GROOVY-9366) Unable represent literal byte
costant
paolo di tommaso created GROOVY-9366:
----------------------------------------
Summary: 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
Groovy does not allow the definition of literal byte constant. 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.3.4#803005)