On May 19, 2014, at 7:52 PM, William Ferguson <william.fergu...@xandar.com.au> 
wrote:

> 
> One of the Maven Java code conventions (listed on that page) is to
> 
>    - Avoid using final modifier on all member variables and arguments.
> 
> I was just querying the sanity of that. All the other code conventions
> either make sense or are a reasonable arbitrary decision. This one appears
> to be the exact opposite of what should be done.
> 

So this is not a good idea in general, but we do not heavily employ constructor 
injection yet and a lot of our code still relies on setter or field injection. 
If the code in question is not a container controlled component definitely make 
fields final where you can. If they are injected you can't. It's a long slog 
but I have a branch where I'm flipping the core to JSR330 and everywhere 
possible I'm using constructor injection and private final fields. So I would 
agree in general that rule is not a good one, just a vestige of how we use our 
container.

> William

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
http://twitter.com/takari_io
---------------------------------------------------------

A language that doesn’t affect the way you think about programming is not worth 
knowing. 
 
 -- Alan Perlis









Reply via email to