Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: effectively immutable vs immutable

...

Wiki Markup
*data race* : "When a program contains two conflicting accesses (§17.4.1) that are not ordered by a happens-before relationship, it is said to contain a data race." \[[JLS 05|AA. Java References#JLS 05]\].

Anchor
effectively immutable
effectively immutable

effectively immutable : When applied to an object, this means that "its state cannot be seen to change by callers, which implies that

  • all public fields are final,
  • all public final reference fields refer to other immutable objects, and
  • constructors and methods do not publish references to any internal state which is potentially mutable by the implementation.

Wiki Markup
Effectively immutable objects may still have internal mutable state for purposes of performance optimization; some state variables may be lazily computed, so long as they are computed from immutable state and that callers cannot tell the difference." \[[Goetz 07|AA. Java References#Goetz 07]\]

Anchor
happens-before order
happens-before order

...

Wiki Markup
*heap memory* : "Memory that can be shared between threads is called shared memory or heap memory. All instance fields, static fields and array elements are stored in heap memory.\[...\] Local variables (§14.4), formal method parameters (§8.4.1) or exception handler parameters are never shared between threads and are unaffected by the memory model." \[[JLS 05|AA. Java References#JLS 05]\]. 

...

immutable
Anchor
immutable
immutable
: When applied to an object, this means that "its state cannot be seen to change by callers, which implies that

...

Wiki Markup
Immutable*immutable* objects: mayWhen stillapplied haveto internalan mutableobject, statethis formeans purposes of performance optimization; somethat its state variables maycannot be lazilychanged computed,after sobeing longinitialized. asIn theyaddition areto computedbeing from[effectively immutable|BB. stateDefinitions#effectively andimmutable], thatall callersfields cannotmust tellbe the differencefinal.
 Immutable objects are inherently thread-safe; they may be passed between threads or published without synchronization."  \[[Goetz 07|AA. Java References#Goetz 07]\]

...