Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.1.1
-
None
Description
Currently this code:
import java.lang.annotation.* @Retention(RetentionPolicy.RUNTIME) @Target([ElementType.TYPE, ElementType.METHOD]) public @interface Foo { int i() default 3 short s() default 3 byte b() default 3 char c1() default 65 char c2() default 'A' char c3() default (char)'A' }
generates compile time errors such as these:
6 compilation errors: Attribute 's' should have type 'java.lang.Short'; but found type 'int' in @Foo at line: 7, column: 23 Attribute 'b' should have type 'java.lang.Byte'; but found type 'int' in @Foo at line: 8, column: 22 Attribute 'c1' should have type 'java.lang.Character'; but found type 'int' in @Foo at line: 9, column: 23 Attribute 'c2' should have type 'java.lang.Character'; but found type 'java.lang.String' in @Foo at line: 10, column: 23 expected '(char) A' to be an inline constant of type char in @Foo at line: 11, column: 23 Attribute 'c3' should have type 'java.lang.Character'; but found type 'java.lang.Object' in @Foo at line: -1, column: -1
Attachments
Issue Links
- is related to
-
GROOVY-7252 Integer literal not accepted for primitive short annotation attribute
- Closed
-
GROOVY-9206 Cannot use annotation with attribute of type char
- Closed
-
GROOVY-9205 Specify primitive annotation default value using number literal with cast/coerce
- Closed
- relates to
-
GROOVY-10068 Cannot compile when set short value to annotation by already defined short variable since version 2.5.4
- Closed