<p>
Exceptions are meant to represent the application's state at which an error occurred.
</p>

<p>Making all fields final ensures that this state:</p>

<ul>
  <li>Will be fully defined at the same time the exception is instantiated.</li>
  <li>Won't be updated or corrupted by some bogus error handler.</li>
</ul>

<p>This will enable developers to quickly understand what went wrong.</p>

<p>The following code:</p>

<pre>
public class MyException extends Exception {

  private int status;                               // Non-Compliant

  public MyException(String message) {
    super(message);
  }

  public int getStatus() {
    return status;
  }

  public void setStatus(int status) {
    this.status = status;
  }

}
</pre>

<p>should be refactored into:</p>

<pre>
public class MyException extends Exception {

  private final int status;                         // Compliant

  public MyException(String message, int status) {
    super(message);
    this.status = status;
  }

  public int getStatus() {
    return status;
  }

}
</pre>