[ 
https://issues.apache.org/jira/browse/GROOVY-10679?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-10679:
---------------------------------
    Labels: annotations  (was: )

> Annotations not being correctly placed in native records
> --------------------------------------------------------
>
>                 Key: GROOVY-10679
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10679
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>              Labels: annotations
>
> For this code:
> {code:java}
> import java.lang.annotation.*
> import groovy.transform.TupleConstructor
> @Target([ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR, 
> ElementType.PARAMETER])
> @Retention(RetentionPolicy.RUNTIME)
> public @interface MyAnno { }
> @MyAnno
> record Car(String make, @MyAnno String model) { }
> assert !Car.getAnnotation(MyAnno)
> assert Car.getMethod('model').getAnnotation(MyAnno)
> assert Car.getConstructor(String, String).getAnnotation(MyAnno)
> assert Car.getConstructor(String, 
> String).getParameterAnnotations()[1][0].annotationType() == MyAnno
> {code}
> Groovy 4 on JDK17 currently fails with:
> {noformat}
> Annotation @MyAnno is not allowed on element RECORD_COMPONENT
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to