"Variable is assigned to itself" inspection improvements

This commit is contained in:
Bas Leijdekkers
2012-11-13 16:19:41 +01:00
parent 549e779b0e
commit 5fd588fa5c
6 changed files with 101 additions and 27 deletions

View File

@@ -7,20 +7,20 @@ class a {
void f(int i) {
<warning descr="Variable is assigned to itself">i = i</warning>;
<warning descr="Variable 'i' is assigned to itself">i = i</warning>;
}
void f2() {
<warning descr="Variable is assigned to itself">this.f = f</warning>;
<warning descr="Variable is assigned to itself">a.this.f = f</warning>;
<warning descr="Variable is assigned to itself">f = this.f</warning>;
<warning descr="Variable 'f' is assigned to itself">this.f = f</warning>;
<warning descr="Variable 'f' is assigned to itself">a.this.f = f</warning>;
<warning descr="Variable 'f' is assigned to itself">f = this.f</warning>;
}
void f3(Object o) {
int i = 0;
<warning descr="Variable is assigned to itself">i = i</warning>;
<warning descr="Variable is assigned to itself">i = (int)i</warning>;
<warning descr="Variable is assigned to itself">o = ((Object)(o))</warning>;
<warning descr="Variable 'i' is assigned to itself">i = i</warning>;
<warning descr="Variable 'i' is assigned to itself">i = (int)i</warning>;
<warning descr="Variable 'o' is assigned to itself">o = ((Object)(o))</warning>;
}
void f4() {
fpanel.getSize().height = this.fpanel.getSize().height; // not silly. Are you sure you can bet getSize() has no side effects?