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

Christopher Smith commented on GROOVY-11231:
--------------------------------------------

{code:groovy}
@TupleConstructor(defaults = false)
class MyService {
  @Qualifier('d')
  Dependency myDependency
}
{code}

Currently, the only way to apply the qualifier to the constructor parameter is 
to hand-write the constructor. Kotlin provides the {{@param:Qualifier}} syntax, 
but while that might be workable for accessors, the Groovy approach to 
constructor generation is quite different.

> TupleConstructor could copy annotations to constructor
> ------------------------------------------------------
>
>                 Key: GROOVY-11231
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11231
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Compiler
>    Affects Versions: 4.0.15
>            Reporter: Christopher Smith
>            Priority: Major
>              Labels: annotations
>
> There are a number of use cases where it is necessary or helpful to annotate 
> constructor arguments; two that I use frequently are injection qualifiers and 
> {{@JsonProperty}}.
> When {{@TupleConstructor}} creates a constructor for a property that carries 
> an annotation that also has a target of {{PARAMETER}}, I propose that it 
> should copy that annotation to the generated constructor parameter.



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

Reply via email to