Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

When a variable is declared final, it is believed to be immutable. If the variable is a primitive type, it can undoubtedly be made final. If the variable is a reference to an object, however, what appears to be final may not always be. Consider for example, a final method parameter that is a references to an object. The argument to this method will use pass-by-value to copy the reference but the referenced data will remain mutable.

Noncompliant Code Example

...