Versions Compared

Key

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

...

This compliant solution ensures that the Foo object is immutable by removing the setter method and declaring the Date field as final. The Date object can be safely published as a result.

Code Block
bgColor#ccccff
public class Foo {
  public final Date d;
    
  public Foo() {
    d = new Date();  
  }
    
  public Date getDate() {
    return d.clone();
  }  
}

Risk Assessment

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

CON26- J

medium

probable

medium

P12

L1

...