You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Apache Wiki <wi...@apache.org> on 2017/02/13 12:34:48 UTC

[Commons Wiki] Update of "CodeStyle" by sebbapache

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=10&rev2=11

Comment:
Warning re: constant inlining

   1. Document authors in POM, not in source files (see http://markmail.org/message/k34w6gsx5iic45z2).
   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.
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org