Minor syntax. I really like this check as I used to use the idiom. BTW, I
think an input test file has not been added to CVS as the unit test fails.
This commit is contained in:
parent
3e5a642f7c
commit
b0902e01cc
|
|
@ -30,8 +30,8 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes;
|
|||
*
|
||||
* See <a href=
|
||||
* "http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html"
|
||||
* >The "Double-Checked Locking is Broken" Declaration</a>
|
||||
* for a more in depth explanation.
|
||||
* >The "Double-Checked Locking is Broken" Declaration</a> for a
|
||||
* more in depth explanation.
|
||||
*
|
||||
* @author Lars Kühne
|
||||
*/
|
||||
|
|
@ -46,13 +46,13 @@ public class DoubleCheckedLockingCheck extends Check
|
|||
/** @see Check */
|
||||
public void visitToken(DetailAST aAST)
|
||||
{
|
||||
DetailAST synchronizedAST =
|
||||
final DetailAST synchronizedAST =
|
||||
getLowestParent(aAST, TokenTypes.LITERAL_SYNCHRONIZED);
|
||||
if (synchronizedAST == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
DetailAST ifAST =
|
||||
final DetailAST ifAST =
|
||||
getLowestParent(synchronizedAST, TokenTypes.LITERAL_IF);
|
||||
if (ifAST == null) {
|
||||
return;
|
||||
|
|
@ -83,8 +83,8 @@ public class DoubleCheckedLockingCheck extends Check
|
|||
private DetailAST getLowestParent(DetailAST aAST, int aTokenType)
|
||||
{
|
||||
DetailAST synchronizedParent = aAST;
|
||||
while (synchronizedParent != null
|
||||
&& synchronizedParent.getType() != aTokenType)
|
||||
while ((synchronizedParent != null)
|
||||
&& (synchronizedParent.getType() != aTokenType))
|
||||
{
|
||||
synchronizedParent = synchronizedParent.getParent();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue