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

Bartosz Popiela updated GROOVY-11721:
-------------------------------------
    Description: We use undeclared Groovy Scripts together with JUnit for 
writing unit tests because it supports sentences as method names and doesn’t 
impose restrictions on the file name (we need the test script name to match the 
name of the YAML file being tested). This solution works very well; the only 
downside is that in order to use annotations on a field, such as 
_@jakarta.inject.Inject_, we also need to use _@groovy.transform.Field_, since 
those annotations typically don’t have target = LOCAL_VARIABLE. It would be 
convenient if _@Field_ could be placed on the script class (with _@Inherited_ 
to support a base script) and be automatically applied to all local variables 
in the script  (was: We use undeclared Groovy Scripts together with JUnit for 
writing unit tests because it supports sentences as method names and doesn’t 
impose restrictions on the file name (we need the test script name to match the 
name of the YAML file being tested). This solution works very well; the only 
downside is that in order to use annotations on a field, such as 
{code:java}
@jakarta.inject.Inject
{code}
, we also need to use 
{code:java}
@groovy.transform.Field
{code}
, since those annotations typically don’t have target = LOCAL_VARIABLE. It 
would be convenient if _@Field_ could be placed on the script class (with 
_@Inherited_ to support a base script) and be automatically applied to all 
local variables in the script)

> @groovy.transform.Field to annotate a script class
> --------------------------------------------------
>
>                 Key: GROOVY-11721
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11721
>             Project: Groovy
>          Issue Type: New Feature
>    Affects Versions: 5.0.0-beta-2
>            Reporter: Bartosz Popiela
>            Priority: Major
>
> We use undeclared Groovy Scripts together with JUnit for writing unit tests 
> because it supports sentences as method names and doesn’t impose restrictions 
> on the file name (we need the test script name to match the name of the YAML 
> file being tested). This solution works very well; the only downside is that 
> in order to use annotations on a field, such as _@jakarta.inject.Inject_, we 
> also need to use _@groovy.transform.Field_, since those annotations typically 
> don’t have target = LOCAL_VARIABLE. It would be convenient if _@Field_ could 
> be placed on the script class (with _@Inherited_ to support a base script) 
> and be automatically applied to all local variables in the script



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

Reply via email to