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:58:00 UTC
[jira] [Updated] (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 ]
Christopher Smith updated GROOVY-10553:
---------------------------------------
Description:
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.
was:
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.
> 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
> 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)