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 2020/01/19 19:02:00 UTC

[jira] [Commented] (GROOVY-9366) Unable represent literal byte costant

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

Eric Milles commented on GROOVY-9366:
-------------------------------------

Duplicate of GROOVY-9206?

> 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
>            Priority: Major
>
> 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.3.4#803005)