class A {
// this field initializer is redundant,
// it is always overwritten in the constructor
int f = 1;
A(int f) {
this.f = f;
}
}
class B {
int method(int i, int j) {
// this initializer is redundant,
// it is overwritten in all branches of the `if`
int k = 0;
// Both the assignments to k are unused, because k is
// not read after the if/else
// This may hide a bug: the programmer probably wanted to return k
if (i < j)
k = i;
else
k = j;
return j;
}
}
class C {
int method() {
int i = 0;
checkSomething(++i); // variable i isn't use anymore after this
}
}