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

ASF GitHub Bot commented on GROOVY-10679:
-----------------------------------------

paulk-asert closed pull request #1746: GROOVY-10679: Annotations not being 
correctly placed in native records
URL: https://github.com/apache/groovy/pull/1746




> 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
>    Affects Versions: 4.0.3
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>              Labels: annotations
>             Fix For: 5.0.0-alpha-1, 4.0.4
>
>
> 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}
> So, the annotation is showing up where it shouldn't.
> In addition, the annotation isn't showing up in other places where it should.
> TL;DR: We have this working for some cases but not all.



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

Reply via email to