Daniel Sun created GROOVY-12816:
-----------------------------------
Summary: Annotation attribute defaults still reject some primitive
casts to short
Key: GROOVY-12816
URL: https://issues.apache.org/jira/browse/GROOVY-12816
Project: Groovy
Issue Type: Bug
Components: Compiler
Reporter: Daniel Sun
GROOVY-6025 (Closed/Fixed in 2.1.2 / 2.2.0-beta-1) added support for `short` /
`byte` / `char` annotation defaults. On current master,
`gls.annotations.AnnotationTest#testAnnotationDefinitionDefaultValues2` in
`src/test/groovy/gls/annotations/AnnotationTest.groovy` is still
`@NotYetImplemented`. It expects `@interface` methods `short s1() default
(byte)1`, `short s2() default (char)2`, and `short s3() default (long)3` to
produce default values 1, 2, and 3. Neighbouring tests already cover same-type
literals and many other casts.
Scanned SHA: `ca71425976fd2e3da6db9634955ba0d39550a6d4`.
Re-checked on 22 Nov 2026 (Asia/Taipei) at the same SHA by temporarily removing
@NotYetImplemented and running the test on JDK 17: it still fails. The
annotation default still rejects a primitive cast to short: "Expected '(byte)
1' to be an inline constant of type short in @A" and "Attribute 's1' should
have type 'java.lang.Short'; but found type 'java.lang.Object'" at short s1()
default (byte)1.
**Acceptance criterion:** Those three default values are accepted and visible
via reflection, and `@NotYetImplemented` is removed.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)