Versions Compared

Key

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

Calling overridable methods from the clone() method is dangerous for two reasons. First, a malicious subclass may override the method and affect the behavior of the clone() method. Second, a trusted subclass may observe the object in an uninitialized state because its construction may not have concluded.

Noncompliant Code Example

Code Block
bgColor#FFcccc

Compliant Solution

Code Block
bgColor#ccccff