This rule is defined by the following Java class: net.sourceforge.pmd.rules.design.NonThreadSafeSingleton
Example:
private static Foo foo = null; //multiple simultaneous callers may see partially initialized objects public static Foo getFoo() { if (foo==null) foo = new Foo(); return foo; }
This rule has the following properties:
Name | Default value | Description |
---|---|---|
checkNonStaticMethods | Do not set this to false and checkNonStaticFields to true | |
checkNonStaticFields | Do not set this to true and checkNonStaticMethods to false |