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

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