net.sourceforge.pmd.rules

Class DoubleCheckedLocking

public class DoubleCheckedLocking extends AbstractRule

void method() { if(x == null) { synchronized(this){ if(x == null) { x = new | method(); } } } 1. The error is when one uses the value assigned within a synchronized section, outside of a synchronized section. if(x == null) is outside of synchronized section x = new | method();

Very very specific check for double checked locking.

Author: CL Gilbert (dnoyeb@users.sourceforge.net)

Method Summary
Objectvisit(ASTClassOrInterfaceDeclaration node, Object data)
Objectvisit(ASTMethodDeclaration node, Object data)

Method Detail

visit

public Object visit(ASTClassOrInterfaceDeclaration node, Object data)

visit

public Object visit(ASTMethodDeclaration node, Object data)