> If you cannot prove it, then
> Integer is immutable in Java, but not in Groovy.
Perhaps I was not clear.
The value of an Integer can be changed in Groovy it can also be
changed in Java.
In both cases reflection has to be used and the setAccessible call
must be used on the Method object.
In both cases if the JVM is started with the "-
Djava.security.manager" flag then the setAccessible will fail and it
will not be possible to change the value of the Integer.
The difference is that it is very easy to change the Integer's value
in Groovy and doing so in Java requires several lines of code.
While we generally like things to be easier in Groovy than in Java,
in this case it seems less than desirable.
We probably should do something about this. My proposal is to use a
custom MetaClass which does not allow access to protected methods.
This MetaClass would be used for Integer and String. Arguably it
should be used for all non public and all final classes in java.*. I
will keep this in mind as I continue to work on the MetaClass.