forked from phoedos/pmd
Changed files to match naming conventions
This commit is contained in:
@ -19,7 +19,7 @@ import net.sourceforge.pmd.lang.java.ast.ASTReturnStatement;
|
|||||||
import net.sourceforge.pmd.lang.java.ast.ASTVariableDeclaratorId;
|
import net.sourceforge.pmd.lang.java.ast.ASTVariableDeclaratorId;
|
||||||
import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule;
|
import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule;
|
||||||
|
|
||||||
public class SingleMethodSingleton extends AbstractJavaRule {
|
public class SingleMethodSingletonRule extends AbstractJavaRule {
|
||||||
|
|
||||||
private static Map<String, ASTFieldDeclaration> fieldDecls = new HashMap<String, ASTFieldDeclaration>();
|
private static Map<String, ASTFieldDeclaration> fieldDecls = new HashMap<String, ASTFieldDeclaration>();
|
||||||
private static Set<ASTFieldDeclaration> returnset = new HashSet<ASTFieldDeclaration>();
|
private static Set<ASTFieldDeclaration> returnset = new HashSet<ASTFieldDeclaration>();
|
@ -13,7 +13,7 @@ import net.sourceforge.pmd.lang.java.ast.ASTPrimaryPrefix;
|
|||||||
import net.sourceforge.pmd.lang.java.ast.ASTReturnStatement;
|
import net.sourceforge.pmd.lang.java.ast.ASTReturnStatement;
|
||||||
import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule;
|
import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule;
|
||||||
|
|
||||||
public class SingletonClassReturningNewInstance extends AbstractJavaRule {
|
public class SingletonClassReturningNewInstanceRule extends AbstractJavaRule {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object visit(ASTMethodDeclaration node, Object data) {
|
public Object visit(ASTMethodDeclaration node, Object data) {
|
@ -1297,11 +1297,11 @@ public static Foo getFoo() {
|
|||||||
]]></example>
|
]]></example>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<rule name="SingleMethodSingletonRule"
|
<rule name="SingleMethodSingleton"
|
||||||
since="5.4"
|
since="5.4"
|
||||||
externalInfoUrl=""
|
externalInfoUrl=""
|
||||||
message="Class contains multiple getInstance methods. Please review."
|
message="Class contains multiple getInstance methods. Please review."
|
||||||
class="net.sourceforge.pmd.lang.java.rule.design.SingleMethodSingleton">
|
class="net.sourceforge.pmd.lang.java.rule.design.SingleMethodSingletonRule">
|
||||||
<description>
|
<description>
|
||||||
Some classes contain overloaded getInstance. The problem with overloaded getInstance methods
|
Some classes contain overloaded getInstance. The problem with overloaded getInstance methods
|
||||||
is that the instance created using the overloaded method is not cached and so,
|
is that the instance created using the overloaded method is not cached and so,
|
||||||
@ -1327,11 +1327,11 @@ public static Singleton getInstance(Object obj){
|
|||||||
</example>
|
</example>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<rule name="SingletonClassReturningNewInstanceRule"
|
<rule name="SingletonClassReturningNewInstance"
|
||||||
since="5.4"
|
since="5.4"
|
||||||
externalInfoUrl=""
|
externalInfoUrl=""
|
||||||
message="getInstance method always creates a new object and hence does not comply to Singleton Design Pattern behaviour. Please review"
|
message="getInstance method always creates a new object and hence does not comply to Singleton Design Pattern behaviour. Please review"
|
||||||
class="net.sourceforge.pmd.lang.java.rule.design.SingletonClassReturningNewInstance">
|
class="net.sourceforge.pmd.lang.java.rule.design.SingletonClassReturningNewInstanceRule">
|
||||||
<description>
|
<description>
|
||||||
Some classes contain overloaded getInstance. The problem with overloaded getInstance methods
|
Some classes contain overloaded getInstance. The problem with overloaded getInstance methods
|
||||||
is that the instance created using the overloaded method is not cached and so,
|
is that the instance created using the overloaded method is not cached and so,
|
||||||
|
Reference in New Issue
Block a user