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

Eric Milles commented on GROOVY-10553:
--------------------------------------

Can you try with the latest snapshot and see if the {{AnnotationFormatError}} 
is gone?

https://github.com/apache/groovy/commit/b8bfccaf6a13edc6094e3e91d29d54eebebf2b03

As for annotation {{NotBlank}} ending up on field and field type, [~paulk] may 
need to weigh in on that.  I don't know how the {{TYPE_USE}} transfer logic is 
designed.

> Regression: Annotation on trait field is illegally duplicated
> -------------------------------------------------------------
>
>                 Key: GROOVY-10553
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10553
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 4.0.1
>            Reporter: Christopher Smith
>            Assignee: Eric Milles
>            Priority: Critical
>
> I have the following types:
> {code}
> trait ShipmentRelated {
>   @NotBlank
>   String shipmentId
> }
> class ShipmentLocationRequest extends Base implements ShipmentRelated {}
> {code}
> In Groovy 3, this compiles correctly:
> {code}
>   private java.lang.String com_example_logistics_ShipmentRelated__shipmentId;
>     descriptor: Ljava/lang/String;
>     flags: (0x0002) ACC_PRIVATE
>     RuntimeVisibleAnnotations:
>       0: #17()        javax.validation.constraints.NotBlank
> {code}
> In Groovy 4 with identical source, I get duplicate annotations (annotation 
> sections?):
> {code}
>   private java.lang.String com_example_logistics_ShipmentRelated__shipmentId;
>     descriptor: Ljava/lang/String;
>     flags: (0x0002) ACC_PRIVATE
>     RuntimeVisibleAnnotations:
>       0: #17()        javax.validation.constraints.NotBlank
>     RuntimeVisibleTypeAnnotations:
>       0: #17(): FIELD        javax.validation.constraints.NotBlank
> {code}
> This causes an {{AnnotationFormatError}} at runtime.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to