R4481 Checkstyle Parameter Rename Issue

Marvin Addison marvin.addison at gmail.com
Tue Sep 13 06:41:56 EDT 2016


On Tue, Sep 13, 2016 at 6:29 AM Etienne Dysli-Metref <
etienne.dysli-metref at switch.ch> wrote:

> > Since you can mix constructor-based and setter-based DI, it is a good
> > rule of thumb to use constructors for mandatory dependencies and
> > setter methods or configuration methods for optional dependencies.
>

For what it's worth, I try to follow this convention in the code I write.
(I recall Brent said as much also.) I think it makes the requisite and
optional component dependencies crystal clear, though with the tradeoff in
Spring wiring as we've noted. I'm hopeful that there is some metadata we
can add to constructor arguments (i.e. annotations) that would preserve the
symbolic names used in the wiring to prevent the "arg renames break wiring"
problem:

http://docs.oracle.com/javase/6/docs/api/java/beans/ConstructorProperties.html

M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/dev/attachments/20160913/906b3477/attachment-0001.html>


More information about the dev mailing list