You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2022/04/27 08:34:00 UTC
[jira] [Closed] (GROOVY-10553) Regression: Annotation on trait field is illegally duplicated
[ https://issues.apache.org/jira/browse/GROOVY-10553?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-10553.
------------------------------
> 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
> Fix For: 5.0.0-alpha-1, 4.0.2
>
>
> 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.7#820007)