[ 
https://issues.apache.org/jira/browse/GROOVY-11311?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Val E updated GROOVY-11311:
---------------------------
    Description: 
In trying to process Groovy closure param annotations, via Java reflection, I 
realized that there is one narrow case where the param annotations are not 
preserved in the generated call method.

This happens only for the case of a single Object param type. All other 
variations retain the annotation, it can be a single param of a different type, 
or multiple params of Object type.

 

ex:

{@TESTANNO def x-> }//{*}wont{*} retain @TESTANNO

{@TESTANNO Object x-> }//{*}wont{*} retain @TESTANNO

{@TESTANNO Integer x-> }//{*}will{*} retain @TESTANNO

{@TESTANNO def x, @TESTANNO def y-> }//{*}will{*} retain @TESTANNO on both x 
and y

 

 

Attached a basic groovy script to demonstrate.

 

  was:
In trying to process Groovy closure param annotations, via Java reflection, I 
realized that there is one narrow case where the param annotations are not 
preserved in the generated call method.

This happens only for the case of a single Object param type. All other 
variations retain the annotation, it can be a single param of a different type, 
or multiple params of Object type.

 

ex:

{@TESTANNO def x-> } //{*}wont{*} retain @TESTANNO

{@TESTANNO Object x-> } //{*}wont{*} retain @TESTANNO

{@TESTANNO Integer x-> } //{*}will{*} retain @TESTANNO

{@TESTANNO def x, @TESTANNO def y-> } //{*}will{*} retain @TESTANNO on both x 
and y

 

 

Attached a basic groovy script to demonstrate.

 


> Groovy Closure not retaining param annotations, but only for the default 
> single object param case
> -------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-11311
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11311
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 3.0.8, 4.0.4
>            Reporter: Val E
>            Priority: Major
>         Attachments: ClosureAnnotationsTest.groovy
>
>
> In trying to process Groovy closure param annotations, via Java reflection, I 
> realized that there is one narrow case where the param annotations are not 
> preserved in the generated call method.
> This happens only for the case of a single Object param type. All other 
> variations retain the annotation, it can be a single param of a different 
> type, or multiple params of Object type.
>  
> ex:
> {@TESTANNO def x-> }//{*}wont{*} retain @TESTANNO
> {@TESTANNO Object x-> }//{*}wont{*} retain @TESTANNO
> {@TESTANNO Integer x-> }//{*}will{*} retain @TESTANNO
> {@TESTANNO def x, @TESTANNO def y-> }//{*}will{*} retain @TESTANNO on both x 
> and y
>  
>  
> Attached a basic groovy script to demonstrate.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to