groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (GROOVY-9051) @groovy.lang.Delegate should generate a constructor annotated with @Generated
Date Thu, 21 Mar 2019 20:35:00 GMT

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

Paul King edited comment on GROOVY-9051 at 3/21/19 8:34 PM:
------------------------------------------------------------

This isn't really specific to {{@Delegate}}. {{@Delegate}} doesn't add any constructor itself
but relies on the normal default constructor creation which currently doesn't add {{@Generated}}.
It looks like {{Verifier#addDefaultConstructor}} doesn't call {{markAsGenerated}}. I'll update
the summary.


was (Author: paulk):
This isn't really specific to {{@Delegate}}. {{@Delegate}} doesn't add any constructor itself
but relies on the normal default constructor creation which currently doesn't add {{@Generated}}.
It looks like {{Verifier#addDefaultConstructor}} doesn't call {{markAsGenerated}}.

> @groovy.lang.Delegate should generate a constructor annotated with @Generated 
> ------------------------------------------------------------------------------
>
>                 Key: GROOVY-9051
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9051
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.5.6
>            Reporter: Jan Wloka
>            Priority: Major
>
> Groovy input:
> {code:java}
> class GroovyDelegateClassTarget {
>     @groovy.lang.Delegate
>     Date target
> }
> {code}
> Groovy output:
> {code}
> public class GroovyDelegateClassTarget implements GroovyObject, Serializable, Cloneable,
Comparable {
>     @Delegate
>     private Date target;
>     public GroovyDelegateClassTarget() {
>         CallSite[] var1 = $getCallSiteArray();
>         super();
>         MetaClass var2 = this.$getStaticMetaClass();
>         this.metaClass = var2;
>     }
>     @Generated
>     public long getTime() {
>         CallSite[] var1 = $getCallSiteArray();
>         return DefaultTypeTransformation.longUnbox(var1[0].call(this.target));
>     }
>     @Generated
>     public void setTime(long param0) {
>         CallSite[] var3 = $getCallSiteArray();
>         var3[1].call(this.target, param0);
>     }
>     @Generated
>     public boolean before(Date param0) {
>         CallSite[] var2 = $getCallSiteArray();
>         return DefaultTypeTransformation.booleanUnbox(var2[2].call(this.target, param0));
>     }
>     @Generated
>     public boolean after(Date param0) {
>         CallSite[] var2 = $getCallSiteArray();
>         return DefaultTypeTransformation.booleanUnbox(var2[3].call(this.target, param0));
>     }
>     @Generated
>     public int compareTo(Date param0) {
>         CallSite[] var2 = $getCallSiteArray();
>         return DefaultTypeTransformation.intUnbox(var2[4].call(this.target, param0));
>     }
>     @Generated
>     public Instant toInstant() {
>         CallSite[] var1 = $getCallSiteArray();
>         return (Instant)ScriptBytecodeAdapter.castToType(var1[5].call(this.target), Instant.class);
>     }
>     @Generated
>     public Date getTarget() {
>         return this.target;
>     }
>     @Generated
>     public void setTarget(Date var1) {
>         this.target = var1;
>     }
> }
> {code}
> The constructor for this class should be annotated with @Generated
> Issue found during Hackergarten Zurich.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message