You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Christopher Smith (Jira)" <ji...@apache.org> on 2022/03/28 18:56:00 UTC
[jira] [Created] (GROOVY-10553) Regression: Annotation on trait field is illegally duplicated
Christopher Smith created GROOVY-10553:
------------------------------------------
Summary: 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
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:
{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)