Java finality
Chris Burdess
dog@bluezoo.org
Mon Feb 7 23:18:00 GMT 2005
This article
http://www.javaspecialists.co.za/archive/Issue096.html
explains how final fields can be modified, and that this behaviour is
sanctioned by JSR 133. However, I find it rather disturbing. I can see
the value of being able to subvert programmer-defined accessibility via
the setAccessible method for e.g. IDE vendors and orthogonal
persistence mechanisms, but I can't see any value in being able to
subvert final fields, especially in ways which are not consistent.
The results for gcj (recent CVS HEAD) on the same corpus show that even
the one change not permitted (albeit silently) by Sun's implementation
is effected without IllegalAccessException. The output of
FinalFieldChange is:
Ng Keng Yap, 27 of IQ=150 from Malaysia
What are other people's thoughts on this matter?
--
Chris Burdess
More information about the Java
mailing list