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 2019/07/25 15:51:00 UTC

[jira] [Created] (GROOVY-9205) Specify primitive annotation default value using number literal with cast/coerce

Eric Milles created GROOVY-9205:
-----------------------------------

             Summary: Specify primitive annotation default value using number literal with cast/coerce
                 Key: GROOVY-9205
                 URL: https://issues.apache.org/jira/browse/GROOVY-9205
             Project: Groovy
          Issue Type: Bug
            Reporter: Eric Milles


Consider the following:
{code:groovy}
@interface A {
  int i1() default (int) 42
  int i2() default 42 as int
  byte b1() default (byte) 42
  byte b2() default 42 as byte
  char c1() default (char) 42
  char c2() default 42 as char
  long l1() default (long) 42
  long l2() default 42 as long
  short s1() default (short) 42
  short s2() default 42 as short
  float f1() default (float) 42
  float f2() default 42 as float
  double d1() default (double) 42
  double d2() default 42 as double
}
print A.getMethod('i1').defaultValue​
{code}

Long, Float and Double defaults cannot currently be specified in this manner.

See also GROOVY-6025



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)