[Solved] Why do I get “unused variable” warnings for a used variable in Eclipse? [closed]


Just the fact that your variable is mentioned elsewhere doesn’t mean it is used. To demonstrate:

public class Test {
  public void x() {
    Node n = new Node();
    n.pivot = null;
    n.pivotIndex = 0;
  }
  private class Node {
    public int[] pivot;
    public int pivotIndex;
  }
}

Now both pivot and pivotIndex are marked as unused, and quite justified: the program never needs their value.

0

solved Why do I get “unused variable” warnings for a used variable in Eclipse? [closed]