Reports private fields that are redundant and can be replaced with a local variable.

If all local usages of a field are preceded by an assignment to that field, the field can be replaced with one or more local variables.

Example:


  class DeskLamp {
    private boolean on = false;

    boolean pressButton() {
      on = true;
      return on;
    }
  }

After the quick-fix is applied:


  class DeskLamp {
    boolean pressButton() {
      boolean on = true;
      return on;
    }
  }