Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.8.8, 2.0.6, 2.1.1
-
None
Description
Groovy respects final modifier for fields and method parameters, but using ++ or -- is still allowed:
class A { final foo = 42 def incrementField() { ++foo } def incrementParam(final a) { ++a } } def a = new A() assert a.incrementField() == 43 assert a.incrementParam(1) == 2
However, a.foo++ throws ReadOnlyPropertyException.