groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MG <mg...@arscreat.com>
Subject @AutoFinal(enabled=false) ?
Date Sun, 08 Oct 2017 19:58:44 GMT
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



Mime
View raw message