fix for 952508 (RequireThis generates Unable find where 'x' is declared.
This commit is contained in:
parent
d8fcf45143
commit
b090a07e19
|
|
@ -201,6 +201,9 @@ checkstyle-user</a>).</li>
|
|||
<li class="body">Fixed 1033166 (Indent module specifies two
|
||||
indent levels for one line)</li>
|
||||
|
||||
<li class="body">Fixed false alarms in RequireThis check (bug
|
||||
952508)</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<p class="body">
|
||||
|
|
|
|||
|
|
@ -238,10 +238,7 @@ public class RequireThisCheck extends Check
|
|||
|
||||
final String name = aAST.getText();
|
||||
final LexicalFrame declared = this.mFrames.findFrame(name);
|
||||
if (declared == null) {
|
||||
log(aAST, "require.this.unfound.variable", name);
|
||||
}
|
||||
else if (declared instanceof ClassFrame) {
|
||||
if (declared instanceof ClassFrame) {
|
||||
log(aAST, "require.this.variable", name);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public class InputRequireThis {
|
|||
i++;
|
||||
this.i = i;
|
||||
method1();
|
||||
j--;
|
||||
j--; // unhandled for now
|
||||
try {
|
||||
this.method1();
|
||||
}
|
||||
|
|
@ -18,5 +18,7 @@ public class InputRequireThis {
|
|||
e.printStackTrace();
|
||||
}
|
||||
this.i--;
|
||||
|
||||
Integer.toString(10);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public class RequireThisCheckTest extends BaseCheckTestCase
|
|||
final String[] expected = {
|
||||
"6:9: Reference to instance variable 'i' needs \"this.\".",
|
||||
"12:9: Method call to 'method1' needs \"this.\".",
|
||||
"13:9: Unable find where 'j' is declared.",
|
||||
// "13:9: Unable find where 'j' is declared.",
|
||||
};
|
||||
verify(checkConfig,
|
||||
getPath("coding" + File.separator + "InputRequireThis.java"),
|
||||
|
|
@ -41,7 +41,7 @@ public class RequireThisCheckTest extends BaseCheckTestCase
|
|||
checkConfig.addAttribute("checkMethods", "false");
|
||||
final String[] expected = {
|
||||
"6:9: Reference to instance variable 'i' needs \"this.\".",
|
||||
"13:9: Unable find where 'j' is declared.",
|
||||
// "13:9: Unable find where 'j' is declared.",
|
||||
};
|
||||
verify(checkConfig,
|
||||
getPath("coding" + File.separator + "InputRequireThis.java"),
|
||||
|
|
|
|||
Loading…
Reference in New Issue