Hi Groovy users,
we are putting the final touches (no pun intended) on the Groovy
@AutoFinal annotation. The intended use is to apply the annotation
automatically to all project classes (see e.g.
http://mrhaki.blogspot.co.at/2016/01/groovy-goodness-customising-groovy.html),
thereby making all parameters anywhere in the project code final without
the need to clutter the code with final keywords in parameter lists.
The question is, if there should be support to disable the annotation
selectively for e.g. a class or method. I personally think that
disabling it for a class violates the principle of least surprise, but
am not as sure for methods. So the question is, can anyone come up with
a good example where disabling @AutoFinal selectively would make sense ?
(Note: "So I can assign a value to a parameter" for me does not
constitute such an example, since in that case one can just define a
local, non-final variable and assign the parameter to it).
Cheers,
mg
- @AutoFinal(enabled=false) ? MG
-