Dear Wiki user, You have subscribed to a wiki page or wiki category on "Commons Wiki" for change notification.
The "CodeStyle" page has been changed by sebbapache: https://wiki.apache.org/commons/CodeStyle?action=diff&rev1=11&rev2=12 Comment: += array entry mutability 1. Object visibility: once code is released, it can be impossible to reduce the visibility of fields, classes, methods without breaking compatibility, so initial releases should use the minimum visibility possible. 1. Mutable data: this increases the difficulty of ensuring thread-safety (including safe publication of changes). Data should be confined to a class; mutation should only be allowed via a setter which can ensure thread-safety. Be careful that the getter does not expose array contents (which are always mutable) 1. Even constants can cause problems: the Java compiler can inline constant values from another class. So if the constant should ever change, classes that are not recompiled could contain the old value. + 1. Array entries are always mutable. Only empty arrays are immutable; they can be safely shared. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
