[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.jdt] Re: Modifying setter generation?

This can be configured. Some people just like to express the value semantics 
of method argument by using the final keyword.

Tobias

"Eric Rizzo" <eclipse@xxxxxxxxxxxx> wrote in message 
news:d7nhpj$beo$1@xxxxxxxxxxxxxxxxxxx
> Sean LeBlanc wrote:
>> I'd like to add the keyword "final" before the argument in the setter 
>> signature. Is there any way to modify the template to do this?
>>
>> I see you can check off "final" but that's for the whole method. I want 
>> it to look like this:
>>
>> public void setFoo(final int foo) {
>>    ...
>> }
>>
>> Otherwise, CheckStyle warns about the variable needing to be final.
>
> Does it really? That is simply not true. There is no inherent *need* for 
> setter arguments to be final. In fact, the only reason I know of to make a 
> method parameter final is when it is used in the code of a local inner 
> class.
> Seems to me CheckStyle is being too stringent in this case.
>
> Eric