Oups, this stateless crap of mine from my previous commit was erronous.
Rule are NOT recreated for each new source file, we need to clean the state of this object... Therefore I add this piece of code back. git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/4.2.x@6986 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -9,6 +9,7 @@ import java.util.List;
|
||||
import net.sourceforge.pmd.AbstractJavaRule;
|
||||
import net.sourceforge.pmd.ast.ASTAssignmentOperator;
|
||||
import net.sourceforge.pmd.ast.ASTClassOrInterfaceDeclaration;
|
||||
import net.sourceforge.pmd.ast.ASTCompilationUnit;
|
||||
import net.sourceforge.pmd.ast.ASTFieldDeclaration;
|
||||
import net.sourceforge.pmd.ast.ASTIfStatement;
|
||||
import net.sourceforge.pmd.ast.ASTLiteral;
|
||||
@ -46,7 +47,17 @@ import net.sourceforge.pmd.ast.Node;
|
||||
*/
|
||||
public class DoubleCheckedLocking extends AbstractJavaRule {
|
||||
|
||||
private List<String> volatileFields = new ArrayList<String>(0);
|
||||
private List<String> volatileFields;
|
||||
|
||||
@Override
|
||||
public Object visit(ASTCompilationUnit compilationUnit,Object data) {
|
||||
if ( this.volatileFields == null ) {
|
||||
this.volatileFields = new ArrayList<String>(0);
|
||||
} else {
|
||||
this.volatileFields.clear();
|
||||
}
|
||||
return super.visit(compilationUnit,data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object visit(ASTClassOrInterfaceDeclaration node, Object data) {
|
||||
|
Reference in New Issue
Block a user