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

Christopher Smith commented on GROOVY-10553:
--------------------------------------------

To clarify (I don't think I included a stack trace but can), I'm getting a
JVM Error-free subclass indicating an illegal duplication of an annotation
(i.e., not rolled up into a container annotation) on invocation of a
built-in reflection method. It's merely that this isn't inspected until HV
queries it.




> 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