diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/cpd/ApexLanguage.java b/pmd-apex/src/main/java/net/sourceforge/pmd/cpd/ApexLanguage.java index 7fed13cc28..45eed23f2d 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/cpd/ApexLanguage.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/cpd/ApexLanguage.java @@ -4,7 +4,7 @@ package net.sourceforge.pmd.cpd; public class ApexLanguage extends AbstractLanguage { - public ApexLanguage() { - super("Apex", "apex", new ApexTokenizer(), ".cls"); - } + public ApexLanguage() { + super("Apex", "apex", new ApexTokenizer(), ".cls"); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/cpd/ApexTokenizer.java b/pmd-apex/src/main/java/net/sourceforge/pmd/cpd/ApexTokenizer.java index 93ade94c40..81e796cad6 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/cpd/ApexTokenizer.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/cpd/ApexTokenizer.java @@ -6,22 +6,22 @@ package net.sourceforge.pmd.cpd; import java.util.ArrayList; public class ApexTokenizer extends AbstractTokenizer { - public ApexTokenizer() { - // setting markers for "string" in apex - this.stringToken = new ArrayList<>(); - this.stringToken.add("\'"); - this.stringToken.add("\""); + public ApexTokenizer() { + // setting markers for "string" in apex + this.stringToken = new ArrayList<>(); + this.stringToken.add("\'"); + this.stringToken.add("\""); - // setting markers for 'ignorable character' in apex - this.ignorableCharacter = new ArrayList<>(); - this.ignorableCharacter.add(";"); + // setting markers for 'ignorable character' in apex + this.ignorableCharacter = new ArrayList<>(); + this.ignorableCharacter.add(";"); - // setting markers for 'ignorable string' in apex - this.ignorableStmt = new ArrayList<>(); + // setting markers for 'ignorable string' in apex + this.ignorableStmt = new ArrayList<>(); - // strings do indeed span multiple lines in apex - this.spanMultipleLinesString = false; - // the lines do to end with backslashes - this.spanMultipleLinesLineContinuationCharacter = '\\'; - } + // strings do indeed span multiple lines in apex + this.spanMultipleLinesString = false; + // the lines do to end with backslashes + this.spanMultipleLinesLineContinuationCharacter = '\\'; + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexHandler.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexHandler.java index dfdbc3a1d2..93ca3fc729 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexHandler.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexHandler.java @@ -23,36 +23,36 @@ import net.sourceforge.pmd.lang.rule.RuleViolationFactory; */ public class ApexHandler extends AbstractLanguageVersionHandler { - @Override - public XPathHandler getXPathHandler() { - return new AbstractASTXPathHandler() { - public void initialize() { - } + @Override + public XPathHandler getXPathHandler() { + return new AbstractASTXPathHandler() { + public void initialize() { + } - public void initialize(IndependentContext context) { - } - }; - } + public void initialize(IndependentContext context) { + } + }; + } - public RuleViolationFactory getRuleViolationFactory() { - return ApexRuleViolationFactory.INSTANCE; - } + public RuleViolationFactory getRuleViolationFactory() { + return ApexRuleViolationFactory.INSTANCE; + } - @Override - public ParserOptions getDefaultParserOptions() { - return new ApexParserOptions(); - } + @Override + public ParserOptions getDefaultParserOptions() { + return new ApexParserOptions(); + } - public Parser getParser(ParserOptions parserOptions) { - return new ApexParser(parserOptions); - } + public Parser getParser(ParserOptions parserOptions) { + return new ApexParser(parserOptions); + } - @Override - public VisitorStarter getDumpFacade(Writer writer, String prefix, boolean recurse) { - return new VisitorStarter() { - public void start(Node rootNode) { - new DumpFacade().initializeWith(writer, prefix, recurse, (ApexNode) rootNode); - } - }; - } + @Override + public VisitorStarter getDumpFacade(Writer writer, String prefix, boolean recurse) { + return new VisitorStarter() { + public void start(Node rootNode) { + new DumpFacade().initializeWith(writer, prefix, recurse, (ApexNode) rootNode); + } + }; + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexLanguageModule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexLanguageModule.java index 14b76922de..7d17bf723c 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexLanguageModule.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexLanguageModule.java @@ -8,11 +8,11 @@ import net.sourceforge.pmd.lang.apex.rule.ApexRuleChainVisitor; public class ApexLanguageModule extends BaseLanguageModule { - public static final String NAME = "Apex"; - public static final String TERSE_NAME = "apex"; + public static final String NAME = "Apex"; + public static final String TERSE_NAME = "apex"; - public ApexLanguageModule() { - super(NAME, null, TERSE_NAME, ApexRuleChainVisitor.class, "cls"); - addVersion("1.0", new ApexHandler(), true); - } + public ApexLanguageModule() { + super(NAME, null, TERSE_NAME, ApexRuleChainVisitor.class, "cls"); + addVersion("1.0", new ApexHandler(), true); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexParser.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexParser.java index 83409c7b88..70672261b6 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexParser.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexParser.java @@ -16,27 +16,27 @@ import net.sourceforge.pmd.lang.ast.ParseException; * Adapter for the ApexParser. */ public class ApexParser extends AbstractParser { - private net.sourceforge.pmd.lang.apex.ast.ApexParser apexParser; + private net.sourceforge.pmd.lang.apex.ast.ApexParser apexParser; - public ApexParser(ParserOptions parserOptions) { - super(parserOptions); - apexParser = new net.sourceforge.pmd.lang.apex.ast.ApexParser((ApexParserOptions) parserOptions); - } + public ApexParser(ParserOptions parserOptions) { + super(parserOptions); + apexParser = new net.sourceforge.pmd.lang.apex.ast.ApexParser((ApexParserOptions) parserOptions); + } - @Override - public TokenManager createTokenManager(Reader source) { - return null; - } + @Override + public TokenManager createTokenManager(Reader source) { + return null; + } - public boolean canParse() { - return true; - } + public boolean canParse() { + return true; + } - public Node parse(String fileName, Reader source) throws ParseException { - return apexParser.parse(source); - } + public Node parse(String fileName, Reader source) throws ParseException { + return apexParser.parse(source); + } - public Map getSuppressMap() { - return apexParser.getSuppressMap(); - } + public Map getSuppressMap() { + return apexParser.getSuppressMap(); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexParserOptions.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexParserOptions.java index 33089da7ef..ba270a1d80 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexParserOptions.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexParserOptions.java @@ -8,25 +8,25 @@ import net.sourceforge.pmd.util.StringUtil; public class ApexParserOptions extends ParserOptions { - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + (1237); - result = prime * result + (1237); - result = prime * result; - return result; - } + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + (1237); + result = prime * result + (1237); + result = prime * result; + return result; + } - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null || getClass() != obj.getClass()) { - return false; - } - final ApexParserOptions that = (ApexParserOptions) obj; - return StringUtil.isSame(this.suppressMarker, that.suppressMarker, false, false, false); - } + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + final ApexParserOptions that = (ApexParserOptions) obj; + return StringUtil.isSame(this.suppressMarker, that.suppressMarker, false, false, false); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTAnnotation.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTAnnotation.java index 31c1881a66..2b3de728fb 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTAnnotation.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTAnnotation.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.modifier.Annotation; public class ASTAnnotation extends AbstractApexNode { - public ASTAnnotation(Annotation annotation) { - super(annotation); - } + public ASTAnnotation(Annotation annotation) { + super(annotation); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTAnnotationParameter.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTAnnotationParameter.java index 61426fb241..8a5a17cc05 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTAnnotationParameter.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTAnnotationParameter.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.modifier.AnnotationParameter; public class ASTAnnotationParameter extends AbstractApexNode { - public ASTAnnotationParameter(AnnotationParameter annotationParameter) { - super(annotationParameter); - } + public ASTAnnotationParameter(AnnotationParameter annotationParameter) { + super(annotationParameter); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTAnonymousClass.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTAnonymousClass.java index 81ce1b595e..5d7eca5bd7 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTAnonymousClass.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTAnonymousClass.java @@ -8,12 +8,12 @@ import net.sourceforge.pmd.lang.ast.RootNode; public class ASTAnonymousClass extends AbstractApexNode implements RootNode { - public ASTAnonymousClass(AnonymousClass anonymousClass) { - super(anonymousClass); - } + public ASTAnonymousClass(AnonymousClass anonymousClass) { + super(anonymousClass); + } - @Override - public String getImage() { - return node.getClass().getName(); - } + @Override + public String getImage() { + return node.getClass().getName(); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTArrayLoadExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTArrayLoadExpression.java index 4716b70e5e..867ad23762 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTArrayLoadExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTArrayLoadExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.ArrayLoadExpression; public class ASTArrayLoadExpression extends AbstractApexNode { - public ASTArrayLoadExpression(ArrayLoadExpression arrayLoadExpression) { - super(arrayLoadExpression); - } + public ASTArrayLoadExpression(ArrayLoadExpression arrayLoadExpression) { + super(arrayLoadExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTArrayStoreExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTArrayStoreExpression.java index fc187994ce..52f1209bd0 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTArrayStoreExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTArrayStoreExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.ArrayStoreExpression; public class ASTArrayStoreExpression extends AbstractApexNode { - public ASTArrayStoreExpression(ArrayStoreExpression arrayStoreExpression) { - super(arrayStoreExpression); - } + public ASTArrayStoreExpression(ArrayStoreExpression arrayStoreExpression) { + super(arrayStoreExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTAssignmentExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTAssignmentExpression.java index 40009506cc..b81663fcbb 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTAssignmentExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTAssignmentExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.AssignmentExpression; public class ASTAssignmentExpression extends AbstractApexNode { - public ASTAssignmentExpression(AssignmentExpression assignmentExpression) { - super(assignmentExpression); - } + public ASTAssignmentExpression(AssignmentExpression assignmentExpression) { + super(assignmentExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBinaryExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBinaryExpression.java index 8f7f84539c..7c93f0e7fc 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBinaryExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBinaryExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.BinaryExpression; public class ASTBinaryExpression extends AbstractApexNode { - public ASTBinaryExpression(BinaryExpression binaryExpression) { - super(binaryExpression); - } + public ASTBinaryExpression(BinaryExpression binaryExpression) { + super(binaryExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBindExpressions.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBindExpressions.java index 2ffd32b741..663ea5cf11 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBindExpressions.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBindExpressions.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.BindExpressions; public class ASTBindExpressions extends AbstractApexNode { - public ASTBindExpressions(BindExpressions bindExpressions) { - super(bindExpressions); - } + public ASTBindExpressions(BindExpressions bindExpressions) { + super(bindExpressions); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBlockStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBlockStatement.java index 08017b0339..e2de0840dd 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBlockStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBlockStatement.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.statement.BlockStatement; public class ASTBlockStatement extends AbstractApexNode { - public ASTBlockStatement(BlockStatement blockStatement) { - super(blockStatement); - } + public ASTBlockStatement(BlockStatement blockStatement) { + super(blockStatement); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBooleanExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBooleanExpression.java index 8f61bcbd72..0dd07e6093 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBooleanExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBooleanExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.BooleanExpression; public class ASTBooleanExpression extends AbstractApexNode { - public ASTBooleanExpression(BooleanExpression booleanExpression) { - super(booleanExpression); - } + public ASTBooleanExpression(BooleanExpression booleanExpression) { + super(booleanExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBreakStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBreakStatement.java index c916f51a1d..6012a36a9d 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBreakStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBreakStatement.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.statement.BreakStatement; public class ASTBreakStatement extends AbstractApexNode { - public ASTBreakStatement(BreakStatement breakStatement) { - super(breakStatement); - } + public ASTBreakStatement(BreakStatement breakStatement) { + super(breakStatement); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBridgeMethodCreator.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBridgeMethodCreator.java index f15ef2f06c..d596f53caa 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBridgeMethodCreator.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBridgeMethodCreator.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.member.bridge.BridgeMethodCreator; public class ASTBridgeMethodCreator extends AbstractApexNode { - public ASTBridgeMethodCreator(BridgeMethodCreator bridgeMethodCreator) { - super(bridgeMethodCreator); - } + public ASTBridgeMethodCreator(BridgeMethodCreator bridgeMethodCreator) { + super(bridgeMethodCreator); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTCatchBlockStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTCatchBlockStatement.java index 4cad26fc8e..d270b9aa7d 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTCatchBlockStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTCatchBlockStatement.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.statement.CatchBlockStatement; public class ASTCatchBlockStatement extends AbstractApexNode { - public ASTCatchBlockStatement(CatchBlockStatement catchBlockStatement) { - super(catchBlockStatement); - } + public ASTCatchBlockStatement(CatchBlockStatement catchBlockStatement) { + super(catchBlockStatement); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTClassRefExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTClassRefExpression.java index 616f2b9621..4cffeac851 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTClassRefExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTClassRefExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.ClassRefExpression; public class ASTClassRefExpression extends AbstractApexNode { - public ASTClassRefExpression(ClassRefExpression classRefExpression) { - super(classRefExpression); - } + public ASTClassRefExpression(ClassRefExpression classRefExpression) { + super(classRefExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTCompilation.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTCompilation.java index 25eae3660b..c2b131a7ee 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTCompilation.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTCompilation.java @@ -7,12 +7,12 @@ import apex.jorje.semantic.ast.compilation.Compilation; import net.sourceforge.pmd.lang.ast.RootNode; public class ASTCompilation extends AbstractApexNode implements RootNode { - public ASTCompilation(Compilation classOrInterface) { - super(classOrInterface); - } + public ASTCompilation(Compilation classOrInterface) { + super(classOrInterface); + } - @Override - public String getImage() { - return node.getClass().getName(); - } + @Override + public String getImage() { + return node.getClass().getName(); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTConstructorPreambleStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTConstructorPreambleStatement.java index 7332d51123..6687080950 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTConstructorPreambleStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTConstructorPreambleStatement.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.statement.ConstructorPreambleStatement; public class ASTConstructorPreambleStatement extends AbstractApexNode { - public ASTConstructorPreambleStatement(ConstructorPreambleStatement constructorPreambleStatement) { - super(constructorPreambleStatement); - } + public ASTConstructorPreambleStatement(ConstructorPreambleStatement constructorPreambleStatement) { + super(constructorPreambleStatement); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTContinueStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTContinueStatement.java index e72e648a63..4aa293523f 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTContinueStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTContinueStatement.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.statement.ContinueStatement; public class ASTContinueStatement extends AbstractApexNode { - public ASTContinueStatement(ContinueStatement continueStatement) { - super(continueStatement); - } + public ASTContinueStatement(ContinueStatement continueStatement) { + super(continueStatement); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlDeleteStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlDeleteStatement.java index 4fdd8bfd24..61b11bf1df 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlDeleteStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlDeleteStatement.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.statement.DmlDeleteStatement; public class ASTDmlDeleteStatement extends AbstractApexNode { - public ASTDmlDeleteStatement(DmlDeleteStatement dmlDeleteStatement) { - super(dmlDeleteStatement); - } + public ASTDmlDeleteStatement(DmlDeleteStatement dmlDeleteStatement) { + super(dmlDeleteStatement); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlInsertStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlInsertStatement.java index 542d474e77..43d597fa67 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlInsertStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlInsertStatement.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.statement.DmlInsertStatement; public class ASTDmlInsertStatement extends AbstractApexNode { - public ASTDmlInsertStatement(DmlInsertStatement dmlInsertStatement) { - super(dmlInsertStatement); - } + public ASTDmlInsertStatement(DmlInsertStatement dmlInsertStatement) { + super(dmlInsertStatement); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlMergeStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlMergeStatement.java index fc8c7f66cf..2db4394bf4 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlMergeStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlMergeStatement.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.statement.DmlMergeStatement; public class ASTDmlMergeStatement extends AbstractApexNode { - public ASTDmlMergeStatement(DmlMergeStatement dmlMergeStatement) { - super(dmlMergeStatement); - } + public ASTDmlMergeStatement(DmlMergeStatement dmlMergeStatement) { + super(dmlMergeStatement); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlUndeleteStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlUndeleteStatement.java index d5264f6b11..6737ff4090 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlUndeleteStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlUndeleteStatement.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.statement.DmlUndeleteStatement; public class ASTDmlUndeleteStatement extends AbstractApexNode { - public ASTDmlUndeleteStatement(DmlUndeleteStatement dmlUndeleteStatement) { - super(dmlUndeleteStatement); - } + public ASTDmlUndeleteStatement(DmlUndeleteStatement dmlUndeleteStatement) { + super(dmlUndeleteStatement); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlUpdateStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlUpdateStatement.java index b3d4d40bfd..a097b54132 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlUpdateStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlUpdateStatement.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.statement.DmlUpdateStatement; public class ASTDmlUpdateStatement extends AbstractApexNode { - public ASTDmlUpdateStatement(DmlUpdateStatement dmlUpdateStatement) { - super(dmlUpdateStatement); - } + public ASTDmlUpdateStatement(DmlUpdateStatement dmlUpdateStatement) { + super(dmlUpdateStatement); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlUpsertStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlUpsertStatement.java index 9e2ab9836c..437794b5e1 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlUpsertStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDmlUpsertStatement.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.statement.DmlUpsertStatement; public class ASTDmlUpsertStatement extends AbstractApexNode { - public ASTDmlUpsertStatement(DmlUpsertStatement dmlUpsertStatement) { - super(dmlUpsertStatement); - } + public ASTDmlUpsertStatement(DmlUpsertStatement dmlUpsertStatement) { + super(dmlUpsertStatement); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDoLoopStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDoLoopStatement.java index e24fa6a1cd..0e7a17e264 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDoLoopStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDoLoopStatement.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.statement.DoLoopStatement; public class ASTDoLoopStatement extends AbstractApexNode { - public ASTDoLoopStatement(DoLoopStatement doLoopStatement) { - super(doLoopStatement); - } + public ASTDoLoopStatement(DoLoopStatement doLoopStatement) { + super(doLoopStatement); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDottedExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDottedExpression.java index 9c45c2578c..c7b71fa1f2 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDottedExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTDottedExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.DottedExpression; public class ASTDottedExpression extends AbstractApexNode { - public ASTDottedExpression(DottedExpression dottedExpression) { - super(dottedExpression); - } + public ASTDottedExpression(DottedExpression dottedExpression) { + super(dottedExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTExpression.java index 71e5cca32c..665f5023fd 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.Expression; public class ASTExpression extends AbstractApexNode { - public ASTExpression(Expression expression) { - super(expression); - } + public ASTExpression(Expression expression) { + super(expression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTExpressionStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTExpressionStatement.java index f8d9bc3808..6d075e2e25 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTExpressionStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTExpressionStatement.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.statement.ExpressionStatement; public class ASTExpressionStatement extends AbstractApexNode { - public ASTExpressionStatement(ExpressionStatement expressionStatement) { - super(expressionStatement); - } + public ASTExpressionStatement(ExpressionStatement expressionStatement) { + super(expressionStatement); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTField.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTField.java index 530f79550d..5758af13b1 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTField.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTField.java @@ -4,12 +4,12 @@ import apex.jorje.semantic.ast.member.Field; public class ASTField extends AbstractApexNode { - public ASTField(Field field) { - super(field); - } + public ASTField(Field field) { + super(field); + } - @Override - public String getImage() { - return node.getFieldInfo().getName(); - } + @Override + public String getImage() { + return node.getFieldInfo().getName(); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTFieldDeclaration.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTFieldDeclaration.java index 20ea456c5f..aca6a07fa9 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTFieldDeclaration.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTFieldDeclaration.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.statement.FieldDeclaration; public class ASTFieldDeclaration extends AbstractApexNode { - public ASTFieldDeclaration(FieldDeclaration fieldDeclaration) { - super(fieldDeclaration); - } + public ASTFieldDeclaration(FieldDeclaration fieldDeclaration) { + super(fieldDeclaration); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTFieldDeclarationStatements.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTFieldDeclarationStatements.java index 38bba4f28f..d4501485e8 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTFieldDeclarationStatements.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTFieldDeclarationStatements.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.statement.FieldDeclarationStatements; public class ASTFieldDeclarationStatements extends AbstractApexNode { - public ASTFieldDeclarationStatements(FieldDeclarationStatements fieldDeclarationStatements) { - super(fieldDeclarationStatements); - } + public ASTFieldDeclarationStatements(FieldDeclarationStatements fieldDeclarationStatements) { + super(fieldDeclarationStatements); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTForEachStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTForEachStatement.java index f2585d9308..eebdaf1680 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTForEachStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTForEachStatement.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.statement.ForEachStatement; public class ASTForEachStatement extends AbstractApexNode { - public ASTForEachStatement(ForEachStatement forEachStatement) { - super(forEachStatement); - } + public ASTForEachStatement(ForEachStatement forEachStatement) { + super(forEachStatement); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTForLoopStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTForLoopStatement.java index 7021046676..5d56e2aa1d 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTForLoopStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTForLoopStatement.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.statement.ForLoopStatement; public class ASTForLoopStatement extends AbstractApexNode { - public ASTForLoopStatement(ForLoopStatement forLoopStatement) { - super(forLoopStatement); - } + public ASTForLoopStatement(ForLoopStatement forLoopStatement) { + super(forLoopStatement); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTIfBlockStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTIfBlockStatement.java index a9df03b4a8..1533186b5c 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTIfBlockStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTIfBlockStatement.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.statement.IfBlockStatement; public class ASTIfBlockStatement extends AbstractApexNode { - public ASTIfBlockStatement(IfBlockStatement ifBlockStatement) { - super(ifBlockStatement); - } + public ASTIfBlockStatement(IfBlockStatement ifBlockStatement) { + super(ifBlockStatement); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTIfElseBlockStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTIfElseBlockStatement.java index fd5121af1d..5b5aa099c9 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTIfElseBlockStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTIfElseBlockStatement.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.statement.IfElseBlockStatement; public class ASTIfElseBlockStatement extends AbstractApexNode { - public ASTIfElseBlockStatement(IfElseBlockStatement ifElseBlockStatement) { - super(ifElseBlockStatement); - } + public ASTIfElseBlockStatement(IfElseBlockStatement ifElseBlockStatement) { + super(ifElseBlockStatement); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTInstanceOfExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTInstanceOfExpression.java index 71a5c24c2e..ce031ee323 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTInstanceOfExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTInstanceOfExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.InstanceOfExpression; public class ASTInstanceOfExpression extends AbstractApexNode { - public ASTInstanceOfExpression(InstanceOfExpression instanceOfExpression) { - super(instanceOfExpression); - } + public ASTInstanceOfExpression(InstanceOfExpression instanceOfExpression) { + super(instanceOfExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTJavaMethodCallExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTJavaMethodCallExpression.java index 49b245e28d..6247c2322d 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTJavaMethodCallExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTJavaMethodCallExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.JavaMethodCallExpression; public class ASTJavaMethodCallExpression extends AbstractApexNode { - public ASTJavaMethodCallExpression(JavaMethodCallExpression javaMethodCallExpression) { - super(javaMethodCallExpression); - } + public ASTJavaMethodCallExpression(JavaMethodCallExpression javaMethodCallExpression) { + super(javaMethodCallExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTJavaVariableExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTJavaVariableExpression.java index 8d931d153e..95750802eb 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTJavaVariableExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTJavaVariableExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.JavaVariableExpression; public class ASTJavaVariableExpression extends AbstractApexNode { - public ASTJavaVariableExpression(JavaVariableExpression javaVariableExpression) { - super(javaVariableExpression); - } + public ASTJavaVariableExpression(JavaVariableExpression javaVariableExpression) { + super(javaVariableExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTLiteralExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTLiteralExpression.java index 2f31a10c1e..6b12f6d313 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTLiteralExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTLiteralExpression.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.expression.LiteralExpression; public class ASTLiteralExpression extends AbstractApexNode { - public ASTLiteralExpression(LiteralExpression literalExpression) { - super(literalExpression); - } + public ASTLiteralExpression(LiteralExpression literalExpression) { + super(literalExpression); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTMapEntryNode.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTMapEntryNode.java index 0262869c67..2af1ac6a77 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTMapEntryNode.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTMapEntryNode.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.MapEntryNode; public class ASTMapEntryNode extends AbstractApexNode { - public ASTMapEntryNode(MapEntryNode mapEntryNode) { - super(mapEntryNode); - } + public ASTMapEntryNode(MapEntryNode mapEntryNode) { + super(mapEntryNode); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTMethod.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTMethod.java index 46a6c37f13..cee3944ed7 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTMethod.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTMethod.java @@ -7,12 +7,12 @@ import apex.jorje.semantic.ast.member.Method; public class ASTMethod extends AbstractApexNode { - public ASTMethod(Method method) { - super(method); - } + public ASTMethod(Method method) { + super(method); + } - @Override - public String getImage() { - return node.getMethodInfo().getIdentifier().value; - } + @Override + public String getImage() { + return node.getMethodInfo().getIdentifier().value; + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTMethodCallExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTMethodCallExpression.java index 85a84ad288..bed336063f 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTMethodCallExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTMethodCallExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.MethodCallExpression; public class ASTMethodCallExpression extends AbstractApexNode { - public ASTMethodCallExpression(MethodCallExpression methodCallExpression) { - super(methodCallExpression); - } + public ASTMethodCallExpression(MethodCallExpression methodCallExpression) { + super(methodCallExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTModifierNode.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTModifierNode.java index c449d41e77..719feff7bc 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTModifierNode.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTModifierNode.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.modifier.ModifierNode; public class ASTModifierNode extends AbstractApexNode { - public ASTModifierNode(ModifierNode modifierNode) { - super(modifierNode); - } + public ASTModifierNode(ModifierNode modifierNode) { + super(modifierNode); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTModifierOrAnnotation.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTModifierOrAnnotation.java index b5cbbcfff4..cfae7f5b7b 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTModifierOrAnnotation.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTModifierOrAnnotation.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.modifier.ModifierOrAnnotation; public class ASTModifierOrAnnotation extends AbstractApexNode { - public ASTModifierOrAnnotation(ModifierOrAnnotation modifierOrAnnotation) { - super(modifierOrAnnotation); - } + public ASTModifierOrAnnotation(ModifierOrAnnotation modifierOrAnnotation) { + super(modifierOrAnnotation); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewListInitExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewListInitExpression.java index 346eba3e73..74d7969e9b 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewListInitExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewListInitExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.NewListInitExpression; public class ASTNewListInitExpression extends AbstractApexNode { - public ASTNewListInitExpression(NewListInitExpression newListInitExpression) { - super(newListInitExpression); - } + public ASTNewListInitExpression(NewListInitExpression newListInitExpression) { + super(newListInitExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewListLiteralExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewListLiteralExpression.java index 28d8a3ff6e..3059725b95 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewListLiteralExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewListLiteralExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.NewListLiteralExpression; public class ASTNewListLiteralExpression extends AbstractApexNode { - public ASTNewListLiteralExpression(NewListLiteralExpression newListLiteralExpression) { - super(newListLiteralExpression); - } + public ASTNewListLiteralExpression(NewListLiteralExpression newListLiteralExpression) { + super(newListLiteralExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewMapInitExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewMapInitExpression.java index 14e2eb5041..e3669b4bbf 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewMapInitExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewMapInitExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.NewMapInitExpression; public class ASTNewMapInitExpression extends AbstractApexNode { - public ASTNewMapInitExpression(NewMapInitExpression newMapInitExpression) { - super(newMapInitExpression); - } + public ASTNewMapInitExpression(NewMapInitExpression newMapInitExpression) { + super(newMapInitExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewMapLiteralExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewMapLiteralExpression.java index ed498e1aa1..278212b1bd 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewMapLiteralExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewMapLiteralExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.NewMapLiteralExpression; public class ASTNewMapLiteralExpression extends AbstractApexNode { - public ASTNewMapLiteralExpression(NewMapLiteralExpression newMapLiteralExpression) { - super(newMapLiteralExpression); - } + public ASTNewMapLiteralExpression(NewMapLiteralExpression newMapLiteralExpression) { + super(newMapLiteralExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewNameValueObjectExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewNameValueObjectExpression.java index 6ba445ebb9..2a1c3ae4e0 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewNameValueObjectExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewNameValueObjectExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.NewNameValueObjectExpression; public class ASTNewNameValueObjectExpression extends AbstractApexNode { - public ASTNewNameValueObjectExpression(NewNameValueObjectExpression newNameValueObjectExpression) { - super(newNameValueObjectExpression); - } + public ASTNewNameValueObjectExpression(NewNameValueObjectExpression newNameValueObjectExpression) { + super(newNameValueObjectExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewObjectExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewObjectExpression.java index 7d74ae80a6..8de8f78a03 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewObjectExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewObjectExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.NewObjectExpression; public class ASTNewObjectExpression extends AbstractApexNode { - public ASTNewObjectExpression(NewObjectExpression newObjectExpression) { - super(newObjectExpression); - } + public ASTNewObjectExpression(NewObjectExpression newObjectExpression) { + super(newObjectExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewSetInitExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewSetInitExpression.java index bbce76d338..28c3ff3873 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewSetInitExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewSetInitExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.NewSetInitExpression; public class ASTNewSetInitExpression extends AbstractApexNode { - public ASTNewSetInitExpression(NewSetInitExpression newSetInitExpression) { - super(newSetInitExpression); - } + public ASTNewSetInitExpression(NewSetInitExpression newSetInitExpression) { + super(newSetInitExpression); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewSetLiteralExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewSetLiteralExpression.java index a64e1e8ffd..c20292736f 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewSetLiteralExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTNewSetLiteralExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.NewSetLiteralExpression; public class ASTNewSetLiteralExpression extends AbstractApexNode { - public ASTNewSetLiteralExpression(NewSetLiteralExpression newSetLiteralExpression) { - super(newSetLiteralExpression); - } + public ASTNewSetLiteralExpression(NewSetLiteralExpression newSetLiteralExpression) { + super(newSetLiteralExpression); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTPackageVersionExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTPackageVersionExpression.java index df21447710..635d5ff97b 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTPackageVersionExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTPackageVersionExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.PackageVersionExpression; public class ASTPackageVersionExpression extends AbstractApexNode { - public ASTPackageVersionExpression(PackageVersionExpression packageVersionExpression) { - super(packageVersionExpression); - } + public ASTPackageVersionExpression(PackageVersionExpression packageVersionExpression) { + super(packageVersionExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTParameter.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTParameter.java index 6cb29361f0..d33c1a85f9 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTParameter.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTParameter.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.member.Parameter; public class ASTParameter extends AbstractApexNode { - public ASTParameter(Parameter parameter) { - super(parameter); - } + public ASTParameter(Parameter parameter) { + super(parameter); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTPostfixExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTPostfixExpression.java index 869b01a633..73b5cf2881 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTPostfixExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTPostfixExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.PostfixExpression; public class ASTPostfixExpression extends AbstractApexNode { - public ASTPostfixExpression(PostfixExpression postfixExpression) { - super(postfixExpression); - } + public ASTPostfixExpression(PostfixExpression postfixExpression) { + super(postfixExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTPrefixExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTPrefixExpression.java index 3e49bdf97d..fb1839f554 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTPrefixExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTPrefixExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.PrefixExpression; public class ASTPrefixExpression extends AbstractApexNode { - public ASTPrefixExpression(PrefixExpression prefixExpression) { - super(prefixExpression); - } + public ASTPrefixExpression(PrefixExpression prefixExpression) { + super(prefixExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTProperty.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTProperty.java index e403891596..75f7e89aa2 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTProperty.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTProperty.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.member.Property; public class ASTProperty extends AbstractApexNode { - public ASTProperty(Property property) { - super(property); - } + public ASTProperty(Property property) { + super(property); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTReferenceExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTReferenceExpression.java index 6963b27313..046ecf749a 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTReferenceExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTReferenceExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.ReferenceExpression; public class ASTReferenceExpression extends AbstractApexNode { - public ASTReferenceExpression(ReferenceExpression referenceExpression) { - super(referenceExpression); - } + public ASTReferenceExpression(ReferenceExpression referenceExpression) { + super(referenceExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTReturnStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTReturnStatement.java index 67e31d0a33..7b9a881674 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTReturnStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTReturnStatement.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.statement.ReturnStatement; public class ASTReturnStatement extends AbstractApexNode { - public ASTReturnStatement(ReturnStatement returnStatement) { - super(returnStatement); - } + public ASTReturnStatement(ReturnStatement returnStatement) { + super(returnStatement); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTRunAsBlockStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTRunAsBlockStatement.java index 4356e8c007..74b2be1d14 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTRunAsBlockStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTRunAsBlockStatement.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.statement.RunAsBlockStatement; public class ASTRunAsBlockStatement extends AbstractApexNode { - public ASTRunAsBlockStatement(RunAsBlockStatement runAsBlockStatement) { - super(runAsBlockStatement); - } + public ASTRunAsBlockStatement(RunAsBlockStatement runAsBlockStatement) { + super(runAsBlockStatement); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSoqlExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSoqlExpression.java index 6dacf2ae8c..a6b7aaecac 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSoqlExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSoqlExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.SoqlExpression; public class ASTSoqlExpression extends AbstractApexNode { - public ASTSoqlExpression(SoqlExpression soqlExpression) { - super(soqlExpression); - } + public ASTSoqlExpression(SoqlExpression soqlExpression) { + super(soqlExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSoslExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSoslExpression.java index 80596a4e22..f8fabd543c 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSoslExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSoslExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.SoslExpression; public class ASTSoslExpression extends AbstractApexNode { - public ASTSoslExpression(SoslExpression soslExpression) { - super(soslExpression); - } + public ASTSoslExpression(SoslExpression soslExpression) { + super(soslExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTStandardCondition.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTStandardCondition.java index 2070ee7d68..ccac81f698 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTStandardCondition.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTStandardCondition.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.condition.StandardCondition; public class ASTStandardCondition extends AbstractApexNode { - public ASTStandardCondition(StandardCondition standardCondition) { - super(standardCondition); - } + public ASTStandardCondition(StandardCondition standardCondition) { + super(standardCondition); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTStatement.java index f3ddf599e6..b428d238a3 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTStatement.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.statement.Statement; public class ASTStatement extends AbstractApexNode { - public ASTStatement(Statement statement) { - super(statement); - } + public ASTStatement(Statement statement) { + super(statement); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSuperMethodCallExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSuperMethodCallExpression.java index 62022ecb99..52739b8ffe 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSuperMethodCallExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSuperMethodCallExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.SuperMethodCallExpression; public class ASTSuperMethodCallExpression extends AbstractApexNode { - public ASTSuperMethodCallExpression(SuperMethodCallExpression superMethodCallExpression) { - super(superMethodCallExpression); - } + public ASTSuperMethodCallExpression(SuperMethodCallExpression superMethodCallExpression) { + super(superMethodCallExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSuperVariableExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSuperVariableExpression.java index 27793be0eb..a823ad4eba 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSuperVariableExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSuperVariableExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.SuperVariableExpression; public class ASTSuperVariableExpression extends AbstractApexNode { - public ASTSuperVariableExpression(SuperVariableExpression superVariableExpression) { - super(superVariableExpression); - } + public ASTSuperVariableExpression(SuperVariableExpression superVariableExpression) { + super(superVariableExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTTernaryExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTTernaryExpression.java index c76cc5b906..fb785d1896 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTTernaryExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTTernaryExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.TernaryExpression; public class ASTTernaryExpression extends AbstractApexNode { - public ASTTernaryExpression(TernaryExpression ternaryExpression) { - super(ternaryExpression); - } + public ASTTernaryExpression(TernaryExpression ternaryExpression) { + super(ternaryExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTTestNode.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTTestNode.java index 090632d4b4..51589d1a28 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTTestNode.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTTestNode.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.tester.TestNode; public class ASTTestNode extends AbstractApexNode { - public ASTTestNode(TestNode testNode) { - super(testNode); - } + public ASTTestNode(TestNode testNode) { + super(testNode); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTThisMethodCallExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTThisMethodCallExpression.java index c9a2c58b13..c992673ebd 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTThisMethodCallExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTThisMethodCallExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.ThisMethodCallExpression; public class ASTThisMethodCallExpression extends AbstractApexNode { - public ASTThisMethodCallExpression(ThisMethodCallExpression thisMethodCallExpression) { - super(thisMethodCallExpression); - } + public ASTThisMethodCallExpression(ThisMethodCallExpression thisMethodCallExpression) { + super(thisMethodCallExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTThisVariableExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTThisVariableExpression.java index d7f97a4bc1..bb98b2c796 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTThisVariableExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTThisVariableExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.ThisVariableExpression; public class ASTThisVariableExpression extends AbstractApexNode { - public ASTThisVariableExpression(ThisVariableExpression thisVariableExpression) { - super(thisVariableExpression); - } + public ASTThisVariableExpression(ThisVariableExpression thisVariableExpression) { + super(thisVariableExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTThrowStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTThrowStatement.java index e6949eea48..8679b08b42 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTThrowStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTThrowStatement.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.statement.ThrowStatement; public class ASTThrowStatement extends AbstractApexNode { - public ASTThrowStatement(ThrowStatement throwStatement) { - super(throwStatement); - } + public ASTThrowStatement(ThrowStatement throwStatement) { + super(throwStatement); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTTriggerVariableExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTTriggerVariableExpression.java index 37e6b4b051..7b8bc2ad86 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTTriggerVariableExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTTriggerVariableExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.TriggerVariableExpression; public class ASTTriggerVariableExpression extends AbstractApexNode { - public ASTTriggerVariableExpression(TriggerVariableExpression triggerVariableExpression) { - super(triggerVariableExpression); - } + public ASTTriggerVariableExpression(TriggerVariableExpression triggerVariableExpression) { + super(triggerVariableExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTTryCatchFinallyBlockStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTTryCatchFinallyBlockStatement.java index d890eb3791..b80be35850 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTTryCatchFinallyBlockStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTTryCatchFinallyBlockStatement.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.statement.TryCatchFinallyBlockStatement; public class ASTTryCatchFinallyBlockStatement extends AbstractApexNode { - public ASTTryCatchFinallyBlockStatement(TryCatchFinallyBlockStatement tryCatchFinallyBlockStatement) { - super(tryCatchFinallyBlockStatement); - } + public ASTTryCatchFinallyBlockStatement(TryCatchFinallyBlockStatement tryCatchFinallyBlockStatement) { + super(tryCatchFinallyBlockStatement); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserClass.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserClass.java index 5dc6ce9550..e9bc2629f0 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserClass.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserClass.java @@ -8,12 +8,12 @@ import net.sourceforge.pmd.lang.ast.RootNode; public class ASTUserClass extends AbstractApexNode implements RootNode { - public ASTUserClass(UserClass userClass) { - super(userClass); - } + public ASTUserClass(UserClass userClass) { + super(userClass); + } - @Override - public String getImage() { - return node.getClass().getName(); - } + @Override + public String getImage() { + return node.getClass().getName(); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserClassMethods.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserClassMethods.java index 5d3ccdc1aa..221eb1b195 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserClassMethods.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserClassMethods.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.compilation.UserClassMethods; public class ASTUserClassMethods extends AbstractApexNode { - public ASTUserClassMethods(UserClassMethods userClassMethods) { - super(userClassMethods); - } + public ASTUserClassMethods(UserClassMethods userClassMethods) { + super(userClassMethods); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserEnum.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserEnum.java index 6701bbce07..1cc2881a37 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserEnum.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserEnum.java @@ -8,12 +8,12 @@ import net.sourceforge.pmd.lang.ast.RootNode; public class ASTUserEnum extends AbstractApexNode implements RootNode { - public ASTUserEnum(UserEnum userEnum) { - super(userEnum); - } + public ASTUserEnum(UserEnum userEnum) { + super(userEnum); + } - @Override - public String getImage() { - return node.getClass().getName(); - } + @Override + public String getImage() { + return node.getClass().getName(); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserExceptionMethods.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserExceptionMethods.java index 79384b27ed..0a169631fc 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserExceptionMethods.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserExceptionMethods.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.compilation.UserExceptionMethods; public class ASTUserExceptionMethods extends AbstractApexNode { - public ASTUserExceptionMethods(UserExceptionMethods userExceptionMethods) { - super(userExceptionMethods); - } + public ASTUserExceptionMethods(UserExceptionMethods userExceptionMethods) { + super(userExceptionMethods); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserInterface.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserInterface.java index 67ab5d1524..9fc8d15222 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserInterface.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserInterface.java @@ -8,20 +8,21 @@ import net.sourceforge.pmd.lang.ast.RootNode; public class ASTUserInterface extends AbstractApexNode implements RootNode { - public ASTUserInterface(UserInterface userInterface) { - super(userInterface); - } + public ASTUserInterface(UserInterface userInterface) { + super(userInterface); + } - @Override - public String getImage() { - try { - Field field = node.getClass().getDeclaredField("name"); - field.setAccessible(true); - Identifier name = (Identifier) field.get(node); - return name.value; - } catch (Exception e) { - e.printStackTrace(); - } - return super.getImage(); - } + @Override + public String getImage() { + try { + Field field = node.getClass().getDeclaredField("name"); + field.setAccessible(true); + Identifier name = (Identifier) field.get(node); + return name.value; + } + catch (Exception e) { + e.printStackTrace(); + } + return super.getImage(); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserTrigger.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserTrigger.java index 52bbe3b8da..3e686ae921 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserTrigger.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserTrigger.java @@ -8,12 +8,12 @@ import net.sourceforge.pmd.lang.ast.RootNode; public class ASTUserTrigger extends AbstractApexNode implements RootNode { - public ASTUserTrigger(UserTrigger userTrigger) { - super(userTrigger); - } + public ASTUserTrigger(UserTrigger userTrigger) { + super(userTrigger); + } - @Override - public String getImage() { - return node.getClass().getName(); - } + @Override + public String getImage() { + return node.getClass().getName(); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTVariableDeclaration.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTVariableDeclaration.java index ed75c091be..2bd619c0c7 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTVariableDeclaration.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTVariableDeclaration.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.statement.VariableDeclaration; public class ASTVariableDeclaration extends AbstractApexNode { - public ASTVariableDeclaration(VariableDeclaration variableDeclaration) { - super(variableDeclaration); - } + public ASTVariableDeclaration(VariableDeclaration variableDeclaration) { + super(variableDeclaration); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTVariableDeclarationStatements.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTVariableDeclarationStatements.java index 4c32825cc7..13923be94c 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTVariableDeclarationStatements.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTVariableDeclarationStatements.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.statement.VariableDeclarationStatements; public class ASTVariableDeclarationStatements extends AbstractApexNode { - public ASTVariableDeclarationStatements(VariableDeclarationStatements variableDeclarationStatements) { - super(variableDeclarationStatements); - } + public ASTVariableDeclarationStatements(VariableDeclarationStatements variableDeclarationStatements) { + super(variableDeclarationStatements); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTVariableExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTVariableExpression.java index 832f494b5c..48a00ad2ca 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTVariableExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTVariableExpression.java @@ -4,7 +4,7 @@ import apex.jorje.semantic.ast.expression.VariableExpression; public class ASTVariableExpression extends AbstractApexNode { - public ASTVariableExpression(VariableExpression variableExpression) { - super(variableExpression); - } + public ASTVariableExpression(VariableExpression variableExpression) { + super(variableExpression); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTWhileLoopStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTWhileLoopStatement.java index f747d781ab..f40283f22f 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTWhileLoopStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTWhileLoopStatement.java @@ -7,7 +7,7 @@ import apex.jorje.semantic.ast.statement.WhileLoopStatement; public class ASTWhileLoopStatement extends AbstractApexNode { - public ASTWhileLoopStatement(WhileLoopStatement whileLoopStatement) { - super(whileLoopStatement); - } + public ASTWhileLoopStatement(WhileLoopStatement whileLoopStatement) { + super(whileLoopStatement); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/AbstractApexNode.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/AbstractApexNode.java index 2b74016083..d8e72c4e21 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/AbstractApexNode.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/AbstractApexNode.java @@ -11,90 +11,93 @@ import apex.jorje.semantic.exception.UnexpectedCodePathException; public abstract class AbstractApexNode extends AbstractNode implements ApexNode { - protected final T node; + protected final T node; - public AbstractApexNode(T node) { - super(node.getDefiningType().hashCode()); - this.node = node; - } + public AbstractApexNode(T node) { + super(node.getDefiningType().hashCode()); + this.node = node; + } - /** - * Accept the visitor. * - */ - public Object jjtAccept(ApexParserVisitor visitor, Object data) { - return visitor.visit(this, data); - } + /** + * Accept the visitor. * + */ + public Object jjtAccept(ApexParserVisitor visitor, Object data) { + return visitor.visit(this, data); + } - /** - * Accept the visitor. * - */ - public Object childrenAccept(ApexParserVisitor visitor, Object data) { - if (children != null) { - for (int i = 0; i < children.length; ++i) { - @SuppressWarnings("unchecked") - // we know that the children here are all ApexNodes - ApexNode apexNode = (ApexNode) children[i]; - apexNode.jjtAccept(visitor, data); - } - } - return data; - } + /** + * Accept the visitor. * + */ + public Object childrenAccept(ApexParserVisitor visitor, Object data) { + if (children != null) { + for (int i = 0; i < children.length; ++i) { + @SuppressWarnings("unchecked") + // we know that the children here are all ApexNodes + ApexNode apexNode = (ApexNode) children[i]; + apexNode.jjtAccept(visitor, data); + } + } + return data; + } - public T getNode() { - return node; - } + public T getNode() { + return node; + } - @Override - public int getBeginLine() { - try { - Loc loc = node.getLoc(); - if (loc instanceof RealLoc) { - return ((RealLoc) loc).line; - } - } catch (UnexpectedCodePathException e) { - // some nodes are artificially generated by the compiler and are not - // really existing in source code - } - return super.getBeginLine(); - } + @Override + public int getBeginLine() { + try { + Loc loc = node.getLoc(); + if (loc instanceof RealLoc) { + return ((RealLoc) loc).line; + } + } + catch (UnexpectedCodePathException e) { + // some nodes are artificially generated by the compiler and are not + // really existing in source code + } + return super.getBeginLine(); + } - @Override - public int getEndLine() { - return getBeginLine(); - } + @Override + public int getEndLine() { + return getBeginLine(); + } - @Override - public int getBeginColumn() { - try { - Loc loc = node.getLoc(); - if (loc instanceof RealLoc) { - return ((RealLoc) loc).column; - } - } catch (UnexpectedCodePathException e) { - // some nodes are artificially generated by the compiler and are not - // really existing in source code - } + @Override + public int getBeginColumn() { + try { + Loc loc = node.getLoc(); + if (loc instanceof RealLoc) { + return ((RealLoc) loc).column; + } + } + catch (UnexpectedCodePathException e) { + // some nodes are artificially generated by the compiler and are not + // really existing in source code + } - return super.getBeginColumn(); - } + return super.getBeginColumn(); + } - @Override - public int getEndColumn() { - try { - Loc loc = node.getLoc(); - if (loc instanceof RealLoc) { - RealLoc realLoc = (RealLoc) loc; - return realLoc.endIndex - realLoc.startIndex + realLoc.column; - } - } catch (UnexpectedCodePathException e) { - // some nodes are artificially generated by the compiler and are not - // really existing in source code - } - return super.getEndColumn(); - } + @Override + public int getEndColumn() { + try { + Loc loc = node.getLoc(); + if (loc instanceof RealLoc) { + RealLoc realLoc = (RealLoc) loc; + return realLoc.endIndex - realLoc.startIndex + realLoc.column; + } + } + catch (UnexpectedCodePathException e) { + // some nodes are artificially generated by the compiler and are not + // really existing in source code + } + return super.getEndColumn(); + } - @Override - public String toString() { - return this.getClass().getSimpleName().replaceFirst("^AST", ""); - } + @Override + public String toString() { + return this.getClass().getSimpleName().replaceFirst("^AST", ""); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/AccessNode.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/AccessNode.java index d1f934a8a9..4bffb204ec 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/AccessNode.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/AccessNode.java @@ -10,43 +10,43 @@ import net.sourceforge.pmd.lang.ast.Node; */ public interface AccessNode extends Node { - int PUBLIC = 0x0001; - int PROTECTED = 0x0002; - int PRIVATE = 0x0004; - int ABSTRACT = 0x0008; - int STATIC = 0x0010; - int FINAL = 0x0020; - int TRANSIENT = 0x0100; + int PUBLIC = 0x0001; + int PROTECTED = 0x0002; + int PRIVATE = 0x0004; + int ABSTRACT = 0x0008; + int STATIC = 0x0010; + int FINAL = 0x0020; + int TRANSIENT = 0x0100; - int getModifiers(); + int getModifiers(); - void setModifiers(int modifiers); + void setModifiers(int modifiers); - boolean isPublic(); + boolean isPublic(); - void setPublic(boolean isPublic); + void setPublic(boolean isPublic); - boolean isProtected(); + boolean isProtected(); - void setProtected(boolean isProtected); + void setProtected(boolean isProtected); - boolean isPrivate(); + boolean isPrivate(); - void setPrivate(boolean isPrivate); + void setPrivate(boolean isPrivate); - boolean isAbstract(); + boolean isAbstract(); - void setAbstract(boolean isAbstract); + void setAbstract(boolean isAbstract); - boolean isStatic(); + boolean isStatic(); - void setStatic(boolean isStatic); + void setStatic(boolean isStatic); - boolean isFinal(); + boolean isFinal(); - void setFinal(boolean isFinal); + void setFinal(boolean isFinal); - void setDefault(boolean isDefault); + void setDefault(boolean isDefault); - boolean isDefault(); + boolean isDefault(); } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexNode.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexNode.java index 826d67584b..7dc3351460 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexNode.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexNode.java @@ -9,18 +9,18 @@ import apex.jorje.semantic.ast.AstNode; public interface ApexNode extends Node { - /** - * Accept the visitor. * - */ - Object jjtAccept(ApexParserVisitor visitor, Object data); + /** + * Accept the visitor. * + */ + Object jjtAccept(ApexParserVisitor visitor, Object data); - /** - * Accept the visitor. * - */ - Object childrenAccept(ApexParserVisitor visitor, Object data); + /** + * Accept the visitor. * + */ + Object childrenAccept(ApexParserVisitor visitor, Object data); - /** - * Get the underlying Rhino AST node. - */ - T getNode(); + /** + * Get the underlying Rhino AST node. + */ + T getNode(); } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexParser.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexParser.java index 27cef9a72e..0dbbc6f986 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexParser.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexParser.java @@ -18,60 +18,61 @@ import apex.jorje.semantic.ast.visitor.AdditionalPassScope; import apex.jorje.semantic.ast.visitor.AstVisitor; public class ApexParser { - protected final ApexParserOptions parserOptions; + protected final ApexParserOptions parserOptions; - private Map suppressMap; - private String suppressMarker = "NOPMD"; // that's the default value + private Map suppressMap; + private String suppressMarker = "NOPMD"; // that's the default value - public ApexParser(ApexParserOptions parserOptions) { - this.parserOptions = parserOptions; + public ApexParser(ApexParserOptions parserOptions) { + this.parserOptions = parserOptions; - if (parserOptions.getSuppressMarker() != null) { - suppressMarker = parserOptions.getSuppressMarker(); - } - } + if (parserOptions.getSuppressMarker() != null) { + suppressMarker = parserOptions.getSuppressMarker(); + } + } - public UserClass parseApex(final String sourceCode) throws ParseException { + public UserClass parseApex(final String sourceCode) throws ParseException { - TopLevelVisitor visitor = new TopLevelVisitor(); - CompilerService.INSTANCE.visitAstFromString(sourceCode, visitor); + TopLevelVisitor visitor = new TopLevelVisitor(); + CompilerService.INSTANCE.visitAstFromString(sourceCode, visitor); - UserClass astRoot = visitor.getTopLevel(); - return astRoot; - } + UserClass astRoot = visitor.getTopLevel(); + return astRoot; + } - public ApexNode parse(final Reader reader) { - try { - final String sourceCode = IOUtils.toString(reader); - final UserClass astRoot = parseApex(sourceCode); - final ApexTreeBuilder treeBuilder = new ApexTreeBuilder(); - suppressMap = new HashMap<>(); + public ApexNode parse(final Reader reader) { + try { + final String sourceCode = IOUtils.toString(reader); + final UserClass astRoot = parseApex(sourceCode); + final ApexTreeBuilder treeBuilder = new ApexTreeBuilder(); + suppressMap = new HashMap<>(); - if (astRoot == null) { - throw new ParseException("Couldn't parse the source - there is not root node - Syntax Error??"); - } + if (astRoot == null) { + throw new ParseException("Couldn't parse the source - there is not root node - Syntax Error??"); + } - ApexNode tree = treeBuilder.build(astRoot); - return tree; - } catch (IOException e) { - throw new ParseException(e); - } - } + ApexNode tree = treeBuilder.build(astRoot); + return tree; + } + catch (IOException e) { + throw new ParseException(e); + } + } - public Map getSuppressMap() { - return suppressMap; - } + public Map getSuppressMap() { + return suppressMap; + } - private class TopLevelVisitor extends AstVisitor { - UserClass topLevel; + private class TopLevelVisitor extends AstVisitor { + UserClass topLevel; - public UserClass getTopLevel() { - return topLevel; - } + public UserClass getTopLevel() { + return topLevel; + } - @Override - public void visitEnd(UserClass node, AdditionalPassScope scope) { - topLevel = node; - } - } + @Override + public void visitEnd(UserClass node, AdditionalPassScope scope) { + topLevel = node; + } + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexTreeBuilder.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexTreeBuilder.java index 73d401304b..c7934d23cd 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexTreeBuilder.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexTreeBuilder.java @@ -97,542 +97,548 @@ import net.sourceforge.pmd.lang.ast.Node; public final class ApexTreeBuilder extends AstVisitor { - private static final Map, Constructor>> NODE_TYPE_TO_NODE_ADAPTER_TYPE = new HashMap<>(); - static { - register(Annotation.class, ASTAnnotation.class); - register(AnonymousClass.class, ASTAnonymousClass.class); - register(ArrayLoadExpression.class, ASTArrayLoadExpression.class); - register(ArrayStoreExpression.class, ASTArrayStoreExpression.class); - register(AssignmentExpression.class, ASTAssignmentExpression.class); - register(BinaryExpression.class, ASTBinaryExpression.class); - register(BindExpressions.class, ASTBindExpressions.class); - register(BlockStatement.class, ASTBlockStatement.class); - register(BreakStatement.class, ASTBreakStatement.class); - register(BooleanExpression.class, ASTBooleanExpression.class); - register(BridgeMethodCreator.class, ASTBridgeMethodCreator.class); - register(CatchBlockStatement.class, ASTCatchBlockStatement.class); - register(ClassRefExpression.class, ASTClassRefExpression.class); - register(ContinueStatement.class, ASTContinueStatement.class); - register(DmlDeleteStatement.class, ASTDmlDeleteStatement.class); - register(DmlInsertStatement.class, ASTDmlInsertStatement.class); - register(DmlMergeStatement.class, ASTDmlMergeStatement.class); - register(DmlUndeleteStatement.class, ASTDmlUndeleteStatement.class); - register(DmlUpdateStatement.class, ASTDmlUpdateStatement.class); - register(DmlUpsertStatement.class, ASTDmlUpsertStatement.class); - register(DoLoopStatement.class, ASTDoLoopStatement.class); - register(DottedExpression.class, ASTDottedExpression.class); - register(Expression.class, ASTExpression.class); - register(ExpressionStatement.class, ASTExpressionStatement.class); - register(Field.class, ASTField.class); - register(FieldDeclaration.class, ASTFieldDeclaration.class); - register(FieldDeclarationStatements.class, ASTFieldDeclarationStatements.class); - register(ForEachStatement.class, ASTForEachStatement.class); - register(ForLoopStatement.class, ASTForLoopStatement.class); - register(IfBlockStatement.class, ASTIfBlockStatement.class); - register(IfElseBlockStatement.class, ASTIfElseBlockStatement.class); - register(InstanceOfExpression.class, ASTInstanceOfExpression.class); - register(JavaMethodCallExpression.class, ASTJavaMethodCallExpression.class); - register(JavaVariableExpression.class, ASTJavaVariableExpression.class); - register(LiteralExpression.class, ASTLiteralExpression.class); - register(MapEntryNode.class, ASTMapEntryNode.class); - register(Method.class, ASTMethod.class); - register(MethodCallExpression.class, ASTMethodCallExpression.class); - register(ModifierNode.class, ASTModifierNode.class); - register(ModifierOrAnnotation.class, ASTModifierOrAnnotation.class); - register(NewListInitExpression.class, ASTNewListInitExpression.class); - register(NewListLiteralExpression.class, ASTNewListLiteralExpression.class); - register(NewMapInitExpression.class, ASTNewMapInitExpression.class); - register(NewMapLiteralExpression.class, ASTNewMapLiteralExpression.class); - register(NewNameValueObjectExpression.class, ASTNewNameValueObjectExpression.class); - register(NewObjectExpression.class, ASTNewObjectExpression.class); - register(NewSetInitExpression.class, ASTNewSetInitExpression.class); - register(NewSetLiteralExpression.class, ASTNewSetLiteralExpression.class); - register(PackageVersionExpression.class, ASTPackageVersionExpression.class); - register(Parameter.class, ASTParameter.class); - register(PostfixExpression.class, ASTPostfixExpression.class); - register(PrefixExpression.class, ASTPrefixExpression.class); - register(Property.class, ASTProperty.class); - register(ReferenceExpression.class, ASTReferenceExpression.class); - register(ReturnStatement.class, ASTReturnStatement.class); - register(RunAsBlockStatement.class, ASTRunAsBlockStatement.class); - register(SoqlExpression.class, ASTSoqlExpression.class); - register(SoslExpression.class, ASTSoslExpression.class); - register(StandardCondition.class, ASTStandardCondition.class); - register(Statement.class, ASTStatement.class); - register(SuperMethodCallExpression.class, ASTSuperMethodCallExpression.class); - register(SuperVariableExpression.class, ASTSuperVariableExpression.class); - register(TernaryExpression.class, ASTTernaryExpression.class); - register(TestNode.class, ASTTestNode.class); - register(ThisMethodCallExpression.class, ASTThisMethodCallExpression.class); - register(ThisVariableExpression.class, ASTThisVariableExpression.class); - register(ThrowStatement.class, ASTThrowStatement.class); - register(TriggerVariableExpression.class, ASTTriggerVariableExpression.class); - register(TryCatchFinallyBlockStatement.class, ASTTryCatchFinallyBlockStatement.class); - register(UserClass.class, ASTUserClass.class); - register(UserClassMethods.class, ASTUserClassMethods.class); - register(UserEnum.class, ASTUserEnum.class); - register(UserExceptionMethods.class, ASTUserExceptionMethods.class); - register(UserInterface.class, ASTUserInterface.class); - register(UserTrigger.class, ASTUserTrigger.class); - register(VariableDeclaration.class, ASTVariableDeclaration.class); - register(VariableDeclarationStatements.class, ASTVariableDeclarationStatements.class); - register(VariableExpression.class, ASTVariableExpression.class); - register(WhileLoopStatement.class, ASTWhileLoopStatement.class); - } - - private static void register(Class nodeType, Class> nodeAdapterType) { - try { - NODE_TYPE_TO_NODE_ADAPTER_TYPE.put(nodeType, nodeAdapterType.getConstructor(nodeType)); - } catch (SecurityException e) { - throw new RuntimeException(e); - } catch (NoSuchMethodException e) { - throw new RuntimeException(e); - } - } - - // The nodes having children built. - private Stack nodes = new Stack<>(); - - // The Apex nodes with children to build. - private Stack parents = new Stack<>(); - - AdditionalPassScope scope = new AdditionalPassScope(new Errors()); - - static ApexNode createNodeAdapter(T node) { - try { - @SuppressWarnings("unchecked") - // the register function makes sure only ApexNode can be added, - // where T is "T extends AstNode". - Constructor> constructor = (Constructor>) NODE_TYPE_TO_NODE_ADAPTER_TYPE - .get(node.getClass()); - if (constructor == null) { - throw new IllegalArgumentException( - "There is no Node adapter class registered for the Node class: " + node.getClass()); - } - return constructor.newInstance(node); - } catch (InstantiationException e) { - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - throw new RuntimeException(e.getTargetException()); - } - } - - public ApexNode build(T astNode) { - // Create a Node - ApexNode node = createNodeAdapter(astNode); - - // Append to parent - Node parent = nodes.isEmpty() ? null : nodes.peek(); - if (parent != null) { - parent.jjtAddChild(node, parent.jjtGetNumChildren()); - node.jjtSetParent(parent); - } - - // Build the children... - nodes.push(node); - parents.push(astNode); - astNode.traverse(this, scope); - nodes.pop(); - parents.pop(); - - return node; - } - - private boolean visit(AstNode node) { - if (parents.peek() == node) { - return true; - } else { - build(node); - return false; - } - } - - @Override - public boolean visit(AnonymousClass node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(UserEnum node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(UserInterface node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(UserTrigger node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(ArrayLoadExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(ArrayStoreExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(AssignmentExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(BinaryExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(BooleanExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(ClassRefExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(InstanceOfExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(JavaMethodCallExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(JavaVariableExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(LiteralExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(ReferenceExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(MethodCallExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(NewListInitExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(NewMapInitExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(NewSetInitExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(NewListLiteralExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(NewObjectExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(NewSetLiteralExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(NewNameValueObjectExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(PackageVersionExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(PostfixExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(PrefixExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(TernaryExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(StandardCondition node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(TriggerVariableExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(DottedExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(VariableExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(BlockStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(BreakStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(ContinueStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(DmlDeleteStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(DmlInsertStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(DmlMergeStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(DmlUndeleteStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(DmlUpdateStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(DmlUpsertStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(DoLoopStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(ExpressionStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(ForEachStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(ForLoopStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(FieldDeclaration node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(FieldDeclarationStatements node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(IfBlockStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(IfElseBlockStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(ReturnStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(RunAsBlockStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(ThrowStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(VariableDeclaration node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(VariableDeclarationStatements node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(WhileLoopStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(BindExpressions node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(SoqlExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(SoslExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(NewMapLiteralExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(MapEntryNode node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(CatchBlockStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(TryCatchFinallyBlockStatement node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(Property node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(Field node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(Parameter node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(BridgeMethodCreator node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(UserClassMethods node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(UserExceptionMethods node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(Annotation node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(AnnotationParameter node, AdditionalPassScope scope) { - return visit(node); - } - - /* - * ModifierGroup is not an AstNode... - * - * @Override public boolean visit(ModifierGroup node, AdditionalPassScope - * scope) { return visit(node); } - */ - - @Override - public boolean visit(ModifierNode node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(SuperMethodCallExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(ThisMethodCallExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(SuperVariableExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(ThisVariableExpression node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(UserClass node, AdditionalPassScope scope) { - return visit(node); - } - - @Override - public boolean visit(Method node, AdditionalPassScope scope) { - return visit(node); - } + private static final Map, Constructor>> NODE_TYPE_TO_NODE_ADAPTER_TYPE = new HashMap<>(); + static { + register(Annotation.class, ASTAnnotation.class); + register(AnonymousClass.class, ASTAnonymousClass.class); + register(ArrayLoadExpression.class, ASTArrayLoadExpression.class); + register(ArrayStoreExpression.class, ASTArrayStoreExpression.class); + register(AssignmentExpression.class, ASTAssignmentExpression.class); + register(BinaryExpression.class, ASTBinaryExpression.class); + register(BindExpressions.class, ASTBindExpressions.class); + register(BlockStatement.class, ASTBlockStatement.class); + register(BreakStatement.class, ASTBreakStatement.class); + register(BooleanExpression.class, ASTBooleanExpression.class); + register(BridgeMethodCreator.class, ASTBridgeMethodCreator.class); + register(CatchBlockStatement.class, ASTCatchBlockStatement.class); + register(ClassRefExpression.class, ASTClassRefExpression.class); + register(ContinueStatement.class, ASTContinueStatement.class); + register(DmlDeleteStatement.class, ASTDmlDeleteStatement.class); + register(DmlInsertStatement.class, ASTDmlInsertStatement.class); + register(DmlMergeStatement.class, ASTDmlMergeStatement.class); + register(DmlUndeleteStatement.class, ASTDmlUndeleteStatement.class); + register(DmlUpdateStatement.class, ASTDmlUpdateStatement.class); + register(DmlUpsertStatement.class, ASTDmlUpsertStatement.class); + register(DoLoopStatement.class, ASTDoLoopStatement.class); + register(DottedExpression.class, ASTDottedExpression.class); + register(Expression.class, ASTExpression.class); + register(ExpressionStatement.class, ASTExpressionStatement.class); + register(Field.class, ASTField.class); + register(FieldDeclaration.class, ASTFieldDeclaration.class); + register(FieldDeclarationStatements.class, ASTFieldDeclarationStatements.class); + register(ForEachStatement.class, ASTForEachStatement.class); + register(ForLoopStatement.class, ASTForLoopStatement.class); + register(IfBlockStatement.class, ASTIfBlockStatement.class); + register(IfElseBlockStatement.class, ASTIfElseBlockStatement.class); + register(InstanceOfExpression.class, ASTInstanceOfExpression.class); + register(JavaMethodCallExpression.class, ASTJavaMethodCallExpression.class); + register(JavaVariableExpression.class, ASTJavaVariableExpression.class); + register(LiteralExpression.class, ASTLiteralExpression.class); + register(MapEntryNode.class, ASTMapEntryNode.class); + register(Method.class, ASTMethod.class); + register(MethodCallExpression.class, ASTMethodCallExpression.class); + register(ModifierNode.class, ASTModifierNode.class); + register(ModifierOrAnnotation.class, ASTModifierOrAnnotation.class); + register(NewListInitExpression.class, ASTNewListInitExpression.class); + register(NewListLiteralExpression.class, ASTNewListLiteralExpression.class); + register(NewMapInitExpression.class, ASTNewMapInitExpression.class); + register(NewMapLiteralExpression.class, ASTNewMapLiteralExpression.class); + register(NewNameValueObjectExpression.class, ASTNewNameValueObjectExpression.class); + register(NewObjectExpression.class, ASTNewObjectExpression.class); + register(NewSetInitExpression.class, ASTNewSetInitExpression.class); + register(NewSetLiteralExpression.class, ASTNewSetLiteralExpression.class); + register(PackageVersionExpression.class, ASTPackageVersionExpression.class); + register(Parameter.class, ASTParameter.class); + register(PostfixExpression.class, ASTPostfixExpression.class); + register(PrefixExpression.class, ASTPrefixExpression.class); + register(Property.class, ASTProperty.class); + register(ReferenceExpression.class, ASTReferenceExpression.class); + register(ReturnStatement.class, ASTReturnStatement.class); + register(RunAsBlockStatement.class, ASTRunAsBlockStatement.class); + register(SoqlExpression.class, ASTSoqlExpression.class); + register(SoslExpression.class, ASTSoslExpression.class); + register(StandardCondition.class, ASTStandardCondition.class); + register(Statement.class, ASTStatement.class); + register(SuperMethodCallExpression.class, ASTSuperMethodCallExpression.class); + register(SuperVariableExpression.class, ASTSuperVariableExpression.class); + register(TernaryExpression.class, ASTTernaryExpression.class); + register(TestNode.class, ASTTestNode.class); + register(ThisMethodCallExpression.class, ASTThisMethodCallExpression.class); + register(ThisVariableExpression.class, ASTThisVariableExpression.class); + register(ThrowStatement.class, ASTThrowStatement.class); + register(TriggerVariableExpression.class, ASTTriggerVariableExpression.class); + register(TryCatchFinallyBlockStatement.class, ASTTryCatchFinallyBlockStatement.class); + register(UserClass.class, ASTUserClass.class); + register(UserClassMethods.class, ASTUserClassMethods.class); + register(UserEnum.class, ASTUserEnum.class); + register(UserExceptionMethods.class, ASTUserExceptionMethods.class); + register(UserInterface.class, ASTUserInterface.class); + register(UserTrigger.class, ASTUserTrigger.class); + register(VariableDeclaration.class, ASTVariableDeclaration.class); + register(VariableDeclarationStatements.class, ASTVariableDeclarationStatements.class); + register(VariableExpression.class, ASTVariableExpression.class); + register(WhileLoopStatement.class, ASTWhileLoopStatement.class); + } + + private static void register(Class nodeType, Class> nodeAdapterType) { + try { + NODE_TYPE_TO_NODE_ADAPTER_TYPE.put(nodeType, nodeAdapterType.getConstructor(nodeType)); + } + catch (SecurityException e) { + throw new RuntimeException(e); + } + catch (NoSuchMethodException e) { + throw new RuntimeException(e); + } + } + + // The nodes having children built. + private Stack nodes = new Stack<>(); + + // The Apex nodes with children to build. + private Stack parents = new Stack<>(); + + AdditionalPassScope scope = new AdditionalPassScope(new Errors()); + + static ApexNode createNodeAdapter(T node) { + try { + @SuppressWarnings("unchecked") + // the register function makes sure only ApexNode can be added, + // where T is "T extends AstNode". + Constructor> constructor = (Constructor>) NODE_TYPE_TO_NODE_ADAPTER_TYPE + .get(node.getClass()); + if (constructor == null) { + throw new IllegalArgumentException( + "There is no Node adapter class registered for the Node class: " + node.getClass()); + } + return constructor.newInstance(node); + } + catch (InstantiationException e) { + throw new RuntimeException(e); + } + catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + catch (InvocationTargetException e) { + throw new RuntimeException(e.getTargetException()); + } + } + + public ApexNode build(T astNode) { + // Create a Node + ApexNode node = createNodeAdapter(astNode); + + // Append to parent + Node parent = nodes.isEmpty() ? null : nodes.peek(); + if (parent != null) { + parent.jjtAddChild(node, parent.jjtGetNumChildren()); + node.jjtSetParent(parent); + } + + // Build the children... + nodes.push(node); + parents.push(astNode); + astNode.traverse(this, scope); + nodes.pop(); + parents.pop(); + + return node; + } + + private boolean visit(AstNode node) { + if (parents.peek() == node) { + return true; + } + else { + build(node); + return false; + } + } + + @Override + public boolean visit(AnonymousClass node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(UserEnum node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(UserInterface node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(UserTrigger node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(ArrayLoadExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(ArrayStoreExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(AssignmentExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(BinaryExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(BooleanExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(ClassRefExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(InstanceOfExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(JavaMethodCallExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(JavaVariableExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(LiteralExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(ReferenceExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(MethodCallExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(NewListInitExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(NewMapInitExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(NewSetInitExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(NewListLiteralExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(NewObjectExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(NewSetLiteralExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(NewNameValueObjectExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(PackageVersionExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(PostfixExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(PrefixExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(TernaryExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(StandardCondition node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(TriggerVariableExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(DottedExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(VariableExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(BlockStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(BreakStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(ContinueStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(DmlDeleteStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(DmlInsertStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(DmlMergeStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(DmlUndeleteStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(DmlUpdateStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(DmlUpsertStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(DoLoopStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(ExpressionStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(ForEachStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(ForLoopStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(FieldDeclaration node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(FieldDeclarationStatements node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(IfBlockStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(IfElseBlockStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(ReturnStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(RunAsBlockStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(ThrowStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(VariableDeclaration node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(VariableDeclarationStatements node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(WhileLoopStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(BindExpressions node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(SoqlExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(SoslExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(NewMapLiteralExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(MapEntryNode node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(CatchBlockStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(TryCatchFinallyBlockStatement node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(Property node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(Field node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(Parameter node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(BridgeMethodCreator node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(UserClassMethods node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(UserExceptionMethods node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(Annotation node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(AnnotationParameter node, AdditionalPassScope scope) { + return visit(node); + } + + /* + * ModifierGroup is not an AstNode... + * + * @Override public boolean visit(ModifierGroup node, AdditionalPassScope + * scope) { return visit(node); } + */ + + @Override + public boolean visit(ModifierNode node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(SuperMethodCallExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(ThisMethodCallExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(SuperVariableExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(ThisVariableExpression node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(UserClass node, AdditionalPassScope scope) { + return visit(node); + } + + @Override + public boolean visit(Method node, AdditionalPassScope scope) { + return visit(node); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/CompilerService.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/CompilerService.java index 03772d5eab..26f742da13 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/CompilerService.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/CompilerService.java @@ -35,102 +35,100 @@ import apex.jorje.semantic.tester.TestQueryValidators; * */ public class CompilerService { - public static final CompilerService INSTANCE = new CompilerService(); - private final SymbolProvider symbolProvider; - private final AccessEvaluator accessEvaluator; - private QueryValidator queryValidator; + public static final CompilerService INSTANCE = new CompilerService(); + private final SymbolProvider symbolProvider; + private final AccessEvaluator accessEvaluator; + private QueryValidator queryValidator; - /** - * Configure a compiler with the default configurations: - * - * @param symbolProvider - * EmptySymbolProvider, doesn't provide any symbols that are not - * part of source. - * @param accessEvaluator - * TestAccessEvaluator, doesn't provide any validation. - * @param queryValidator - * TestQueryValidators.Noop, no validation of queries. - */ - CompilerService() { - this(EmptySymbolProvider.get(), new TestAccessEvaluator(), new TestQueryValidators.Noop()); - } + /** + * Configure a compiler with the default configurations: + * + * @param symbolProvider + * EmptySymbolProvider, doesn't provide any symbols that are not + * part of source. + * @param accessEvaluator + * TestAccessEvaluator, doesn't provide any validation. + * @param queryValidator + * TestQueryValidators.Noop, no validation of queries. + */ + CompilerService() { + this(EmptySymbolProvider.get(), new TestAccessEvaluator(), new TestQueryValidators.Noop()); + } - /** - * Configure a compiler with the following configurations: - * - * @param symbolProvider - * A way to retrieve symbols, where symbols are names of types. - * @param accessEvaluator - * A way to check for accesses to certain fields in types. - * @param queryValidator - * A way to validate your queries. - */ - public CompilerService(SymbolProvider symbolProvider, AccessEvaluator accessEvaluator, - QueryValidator queryValidator) { - this.symbolProvider = symbolProvider; - this.accessEvaluator = accessEvaluator; - this.queryValidator = queryValidator; - } + /** + * Configure a compiler with the following configurations: + * + * @param symbolProvider + * A way to retrieve symbols, where symbols are names of types. + * @param accessEvaluator + * A way to check for accesses to certain fields in types. + * @param queryValidator + * A way to validate your queries. + */ + public CompilerService(SymbolProvider symbolProvider, AccessEvaluator accessEvaluator, + QueryValidator queryValidator) { + this.symbolProvider = symbolProvider; + this.accessEvaluator = accessEvaluator; + this.queryValidator = queryValidator; + } - public ApexCompiler visitAstFromString(String source, AstVisitor visitor) { - return visitAstsFromStrings(ImmutableList.of(source), visitor, CompilerStage.POST_TYPE_RESOLVE); - } + public ApexCompiler visitAstFromString(String source, AstVisitor visitor) { + return visitAstsFromStrings(ImmutableList.of(source), visitor, CompilerStage.POST_TYPE_RESOLVE); + } - public ApexCompiler visitAstsFromStrings(List sources, AstVisitor visitor) { - return visitAstsFromStrings(sources, visitor, CompilerStage.POST_TYPE_RESOLVE); - } + public ApexCompiler visitAstsFromStrings(List sources, AstVisitor visitor) { + return visitAstsFromStrings(sources, visitor, CompilerStage.POST_TYPE_RESOLVE); + } - public ApexCompiler visitAstsFromStrings(List sources, AstVisitor visitor, - CompilerStage compilerStage) { - List sourceFiles = sources.stream() - .map(s -> SourceFile.builder().setBody(canonicalizeString(s)).build()).collect(Collectors.toList()); - CompilationInput compilationUnit = createCompilationInput(sourceFiles, visitor); - return compile(compilationUnit, visitor, compilerStage); - } + public ApexCompiler visitAstsFromStrings(List sources, AstVisitor visitor, CompilerStage compilerStage) { + List sourceFiles = sources.stream().map(s -> SourceFile.builder().setBody(canonicalizeString(s)).build()).collect(Collectors.toList()); + CompilationInput compilationUnit = createCompilationInput(sourceFiles, visitor); + return compile(compilationUnit, visitor, compilerStage); + } - private ApexCompiler compile(CompilationInput compilationInput, AstVisitor visitor, - CompilerStage compilerStage) { - ApexCompiler compiler = ApexCompiler.builder().setInput(compilationInput).build(); - compiler.compile(compilerStage); - callAdditionalPassVisitor(compiler); - return compiler; - } + private ApexCompiler compile(CompilationInput compilationInput, AstVisitor visitor, CompilerStage compilerStage) { + ApexCompiler compiler = ApexCompiler.builder().setInput(compilationInput).build(); + compiler.compile(compilerStage); + callAdditionalPassVisitor(compiler); + return compiler; + } - private CompilationInput createCompilationInput(List sourceFiles, - AstVisitor visitor) { - return new CompilationInput(sourceFiles, symbolProvider, accessEvaluator, queryValidator, visitor); - } + private CompilationInput createCompilationInput(List sourceFiles, + AstVisitor visitor) { + return new CompilationInput(sourceFiles, symbolProvider, accessEvaluator, queryValidator, visitor); + } - /** - * This is temporary workaround to bypass the validation stage of the - * compiler while *still* doing the additional_validate stage. We are - * bypassing the validation stage because it does a deep validation that we - * don't have all the parts for yet in the offline compiler. Rather than - * stop all work on that, we bypass it so that we can still do useful things - * like find all your types, find all your methods, etc. - * - */ - @SuppressWarnings("unchecked") - private void callAdditionalPassVisitor(ApexCompiler compiler) { - try { - List allUnits = (List) FieldUtils.readDeclaredField(compiler, "allUnits", true); - CompilerContext compilerContext = (CompilerContext) FieldUtils.readDeclaredField(compiler, - "compilerContext", true); + /** + * This is temporary workaround to bypass the validation stage of the + * compiler while *still* doing the additional_validate stage. We are + * bypassing the validation stage because it does a deep validation that we + * don't have all the parts for yet in the offline compiler. Rather than + * stop all work on that, we bypass it so that we can still do useful things + * like find all your types, find all your methods, etc. + * + */ + @SuppressWarnings("unchecked") + private void callAdditionalPassVisitor(ApexCompiler compiler) { + try { + List allUnits = (List) FieldUtils.readDeclaredField(compiler, "allUnits", true); + CompilerContext compilerContext = (CompilerContext) FieldUtils.readDeclaredField(compiler, + "compilerContext", true); - for (CodeUnit unit : allUnits) { - Method getOperation = CompilerStage.ADDITIONAL_VALIDATE.getDeclaringClass() - .getDeclaredMethod("getOperation"); - getOperation.setAccessible(true); - CompilerOperation operation = (CompilerOperation) getOperation - .invoke(CompilerStage.ADDITIONAL_VALIDATE); - operation.invoke(compilerContext, unit); - } - } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { - } - } + for (CodeUnit unit : allUnits) { + Method getOperation = CompilerStage.ADDITIONAL_VALIDATE.getDeclaringClass() + .getDeclaredMethod("getOperation"); + getOperation.setAccessible(true); + CompilerOperation operation = (CompilerOperation) getOperation + .invoke(CompilerStage.ADDITIONAL_VALIDATE); + operation.invoke(compilerContext, unit); + } + } + catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { + } + } - public static String canonicalizeString(String inputString) { - String text = inputString.replaceAll("(\\r\\n|\\r)", Matcher.quoteReplacement("\n")); - return text; - } + public static String canonicalizeString(String inputString) { + String text = inputString.replaceAll("(\\r\\n|\\r)", Matcher.quoteReplacement("\n")); + return text; + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/DumpFacade.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/DumpFacade.java index 13a2e6a339..849d5818d1 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/DumpFacade.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/DumpFacade.java @@ -13,72 +13,74 @@ import net.sourceforge.pmd.util.StringUtil; public class DumpFacade { - private PrintWriter writer; - private boolean recurse; + private PrintWriter writer; + private boolean recurse; - public void initializeWith(Writer writer, String prefix, boolean recurse, ApexNode node) { - this.writer = writer instanceof PrintWriter ? (PrintWriter) writer : new PrintWriter(writer); - this.recurse = recurse; - this.dump(node, prefix); - try { - writer.flush(); - } catch (IOException e) { - throw new RuntimeException("Problem flushing PrintWriter.", e); - } - } + public void initializeWith(Writer writer, String prefix, boolean recurse, ApexNode node) { + this.writer = writer instanceof PrintWriter ? (PrintWriter) writer : new PrintWriter(writer); + this.recurse = recurse; + this.dump(node, prefix); + try { + writer.flush(); + } + catch (IOException e) { + throw new RuntimeException("Problem flushing PrintWriter.", e); + } + } - public Object visit(ApexNode node, Object data) { - dump(node, (String) data); - if (recurse) { - for (int i = 0; i < node.jjtGetNumChildren(); i++) { - visit((ApexNode) node.jjtGetChild(i), data + " "); - } - return data; - } else { - return data; - } - } + public Object visit(ApexNode node, Object data) { + dump(node, (String) data); + if (recurse) { + for (int i = 0; i < node.jjtGetNumChildren(); i++) { + visit((ApexNode) node.jjtGetChild(i), data + " "); + } + return data; + } + else { + return data; + } + } - private void dump(ApexNode node, String prefix) { - // - // Dump format is generally composed of the following items... - // + private void dump(ApexNode node, String prefix) { + // + // Dump format is generally composed of the following items... + // - // 1) Dump prefix - writer.print(prefix); + // 1) Dump prefix + writer.print(prefix); - // 2) JJT Name of the Node - writer.print(node.toString()); + // 2) JJT Name of the Node + writer.print(node.toString()); - // - // If there are any additional details, then: - // 1) A colon - // 2) The Node.getImage() if it is non-empty - // 3) Extras in parentheses - // + // + // If there are any additional details, then: + // 1) A colon + // 2) The Node.getImage() if it is non-empty + // 3) Extras in parentheses + // - // Standard image handling - String image = node.getImage(); + // Standard image handling + String image = node.getImage(); - // Special image handling (e.g. Nodes with normally null images) - image = StringUtil.escapeWhitespace(image); + // Special image handling (e.g. Nodes with normally null images) + image = StringUtil.escapeWhitespace(image); - // Extras - List extras = new ArrayList<>(); + // Extras + List extras = new ArrayList<>(); - // Output image and extras - if (image != null || !extras.isEmpty()) { - writer.print(':'); - if (image != null) { - writer.print(image); - } - for (String extra : extras) { - writer.print('('); - writer.print(extra); - writer.print(')'); - } - } + // Output image and extras + if (image != null || !extras.isEmpty()) { + writer.print(':'); + if (image != null) { + writer.print(image); + } + for (String extra : extras) { + writer.print('('); + writer.print(extra); + writer.print(')'); + } + } - writer.println(); - } + writer.println(); + } } \ No newline at end of file diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/AbstractStatisticalApexRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/AbstractStatisticalApexRule.java index bde86d51c7..2526a0151c 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/AbstractStatisticalApexRule.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/AbstractStatisticalApexRule.java @@ -13,19 +13,19 @@ import net.sourceforge.pmd.stat.DataPoint; public abstract class AbstractStatisticalApexRule extends AbstractApexRule implements StatisticalRule { - private final StatisticalRuleHelper helper = new StatisticalRuleHelper(this); + private final StatisticalRuleHelper helper = new StatisticalRuleHelper(this); - public void addDataPoint(DataPoint point) { - helper.addDataPoint(point); - } + public void addDataPoint(DataPoint point) { + helper.addDataPoint(point); + } - public Object[] getViolationParameters(DataPoint point) { - return null; - } + public Object[] getViolationParameters(DataPoint point) { + return null; + } - @Override - public void apply(List nodes, RuleContext ctx) { - super.apply(nodes, ctx); - helper.apply(ctx); - } + @Override + public void apply(List nodes, RuleContext ctx) { + super.apply(nodes, ctx); + helper.apply(ctx); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/ApexRuleChainVisitor.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/ApexRuleChainVisitor.java index 77229399a2..35f92a4ced 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/ApexRuleChainVisitor.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/ApexRuleChainVisitor.java @@ -17,28 +17,29 @@ import net.sourceforge.pmd.lang.rule.XPathRule; public class ApexRuleChainVisitor extends AbstractRuleChainVisitor { - protected void indexNodes(List nodes, RuleContext ctx) { - // Visit Nodes in DFS order - Stack stack = new Stack<>(); - stack.addAll(nodes); - Collections.reverse(stack); - while (!stack.isEmpty()) { - Node node = stack.pop(); - indexNode(node); - if (node.jjtGetNumChildren() > 0) { - for (int i = node.jjtGetNumChildren() - 1; i >= 0; i--) { - stack.push(node.jjtGetChild(i)); - } - } - } - } + protected void indexNodes(List nodes, RuleContext ctx) { + // Visit Nodes in DFS order + Stack stack = new Stack<>(); + stack.addAll(nodes); + Collections.reverse(stack); + while (!stack.isEmpty()) { + Node node = stack.pop(); + indexNode(node); + if (node.jjtGetNumChildren() > 0) { + for (int i = node.jjtGetNumChildren() - 1; i >= 0; i--) { + stack.push(node.jjtGetChild(i)); + } + } + } + } - protected void visit(Rule rule, Node node, RuleContext ctx) { - // Rule better either be a ApexParserVisitor, or a XPathRule - if (rule instanceof XPathRule) { - ((XPathRule) rule).evaluate(node, ctx); - } else { - ((ApexNode) node).jjtAccept((ApexParserVisitor) rule, ctx); - } - } + protected void visit(Rule rule, Node node, RuleContext ctx) { + // Rule better either be a ApexParserVisitor, or a XPathRule + if (rule instanceof XPathRule) { + ((XPathRule) rule).evaluate(node, ctx); + } + else { + ((ApexNode) node).jjtAccept((ApexParserVisitor) rule, ctx); + } + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/ApexRuleViolationFactory.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/ApexRuleViolationFactory.java index 82cd33a52e..6a2ae9a452 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/ApexRuleViolationFactory.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/ApexRuleViolationFactory.java @@ -13,19 +13,19 @@ import net.sourceforge.pmd.lang.rule.AbstractRuleViolationFactory; public final class ApexRuleViolationFactory extends AbstractRuleViolationFactory { - public static final ApexRuleViolationFactory INSTANCE = new ApexRuleViolationFactory(); + public static final ApexRuleViolationFactory INSTANCE = new ApexRuleViolationFactory(); - private ApexRuleViolationFactory() { - } + private ApexRuleViolationFactory() { + } - @SuppressWarnings("rawtypes") - @Override - protected RuleViolation createRuleViolation(Rule rule, RuleContext ruleContext, Node node, String message) { - return new ParametricRuleViolation<>(rule, ruleContext, (ApexNode) node, message); - } + @SuppressWarnings("rawtypes") + @Override + protected RuleViolation createRuleViolation(Rule rule, RuleContext ruleContext, Node node, String message) { + return new ParametricRuleViolation<>(rule, ruleContext, (ApexNode) node, message); + } - protected RuleViolation createRuleViolation(Rule rule, RuleContext ruleContext, Node node, String message, - int beginLine, int endLine) { - return null; // FIXME - } + protected RuleViolation createRuleViolation(Rule rule, RuleContext ruleContext, Node node, String message, + int beginLine, int endLine) { + return null; // FIXME + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/ApexXPathRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/ApexXPathRule.java index dc9267de3c..afd409a022 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/ApexXPathRule.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/ApexXPathRule.java @@ -11,12 +11,12 @@ import net.sourceforge.pmd.lang.rule.XPathRule; public class ApexXPathRule extends XPathRule { - public ApexXPathRule() { - super.setLanguage(LanguageRegistry.getLanguage(ApexLanguageModule.NAME)); - } + public ApexXPathRule() { + super.setLanguage(LanguageRegistry.getLanguage(ApexLanguageModule.NAME)); + } - @Override - public ParserOptions getParserOptions() { - return new ApexParserOptions(); - } + @Override + public ParserOptions getParserOptions() { + return new ApexParserOptions(); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/AbstractNcssCountRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/AbstractNcssCountRule.java index e2d020d597..b18792ae6d 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/AbstractNcssCountRule.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/AbstractNcssCountRule.java @@ -26,101 +26,105 @@ import net.sourceforge.pmd.util.NumericConstants; */ public abstract class AbstractNcssCountRule extends AbstractStatisticalApexRule { - private Class nodeClass; + private Class nodeClass; - /** - * Count the nodes of the given type using NCSS rules. - * - * @param nodeClass - * class of node to count - */ - protected AbstractNcssCountRule(Class nodeClass) { - this.nodeClass = nodeClass; - } + /** + * Count the nodes of the given type using NCSS rules. + * + * @param nodeClass + * class of node to count + */ + protected AbstractNcssCountRule(Class nodeClass) { + this.nodeClass = nodeClass; + } - @Override - public Object visit(ApexNode node, Object data) { - int numNodes = 0; + @Override + public Object visit(ApexNode node, Object data) { + int numNodes = 0; - for (int i = 0; i < node.jjtGetNumChildren(); i++) { - ApexNode n = (ApexNode) node.jjtGetChild(i); - Integer treeSize = (Integer) n.jjtAccept(this, data); - numNodes += treeSize.intValue(); - } + for (int i = 0; i < node.jjtGetNumChildren(); i++) { + ApexNode n = (ApexNode) node.jjtGetChild(i); + Integer treeSize = (Integer) n.jjtAccept(this, data); + numNodes += treeSize.intValue(); + } - if (this.nodeClass.isInstance(node)) { - // Add 1 to account for base node - numNodes++; - DataPoint point = new DataPoint(); - point.setNode(node); - point.setScore(1.0 * numNodes); - point.setMessage(getMessage()); - addDataPoint(point); - } + if (this.nodeClass.isInstance(node)) { + // Add 1 to account for base node + numNodes++; + DataPoint point = new DataPoint(); + point.setNode(node); + point.setScore(1.0 * numNodes); + point.setMessage(getMessage()); + addDataPoint(point); + } - return Integer.valueOf(numNodes); - } + return Integer.valueOf(numNodes); + } - /** - * Count the number of children of the given Java node. Adds one to count - * the node itself. - * - * @param node - * java node having children counted - * @param data - * node data - * @return count of the number of children of the node, plus one - */ - protected Integer countNodeChildren(Node node, Object data) { - Integer nodeCount = null; - int lineCount = 0; - for (int i = 0; i < node.jjtGetNumChildren(); i++) { - nodeCount = (Integer) ((ApexNode) node.jjtGetChild(i)).jjtAccept(this, data); - lineCount += nodeCount.intValue(); - } - return ++lineCount; - } + /** + * Count the number of children of the given Java node. Adds one to count + * the node itself. + * + * @param node + * java node having children counted + * @param data + * node data + * @return count of the number of children of the node, plus one + */ + protected Integer countNodeChildren(Node node, Object data) { + Integer nodeCount = null; + int lineCount = 0; + for (int i = 0; i < node.jjtGetNumChildren(); i++) { + nodeCount = (Integer) ((ApexNode) node.jjtGetChild(i)).jjtAccept(this, data); + lineCount += nodeCount.intValue(); + } + return ++lineCount; + } - public Object visit(ASTForEachStatement node, Object data) { - return countNodeChildren(node, data); - } + public Object visit(ASTForEachStatement node, Object data) { + return countNodeChildren(node, data); + } - public Object visit(ASTForLoopStatement node, Object data) { - return countNodeChildren(node, data); - } + public Object visit(ASTForLoopStatement node, Object data) { + return countNodeChildren(node, data); + } - public Object visit(ASTIfBlockStatement node, Object data) { + public Object visit(ASTIfBlockStatement node, Object data) { - Integer lineCount = countNodeChildren(node, data); + Integer lineCount = countNodeChildren(node, data); - return lineCount; - } + return lineCount; + } - public Object visit(ASTIfElseBlockStatement node, Object data) { + public Object visit(ASTIfElseBlockStatement node, Object data) { - Integer lineCount = countNodeChildren(node, data); - lineCount++; - return lineCount; - } + Integer lineCount = countNodeChildren(node, data); + lineCount++; + return lineCount; + } - public Object visit(ASTWhileLoopStatement node, Object data) { - return countNodeChildren(node, data); - } + @Override + public Object visit(ASTWhileLoopStatement node, Object data) { + return countNodeChildren(node, data); + } - public Object visit(ASTBreakStatement node, Object data) { - return NumericConstants.ONE; - } + @Override + public Object visit(ASTBreakStatement node, Object data) { + return NumericConstants.ONE; + } - public Object visit(ASTTryCatchFinallyBlockStatement node, Object data) { - return countNodeChildren(node, data); - } + @Override + public Object visit(ASTTryCatchFinallyBlockStatement node, Object data) { + return countNodeChildren(node, data); + } - public Object visit(ASTReturnStatement node, Object data) { - return countNodeChildren(node, data); - } - - public Object visit(ASTThrowStatement node, Object data) { - return NumericConstants.ONE; - } + @Override + public Object visit(ASTReturnStatement node, Object data) { + return countNodeChildren(node, data); + } + @Override + public Object visit(ASTThrowStatement node, Object data) { + return NumericConstants.ONE; + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/CyclomaticComplexityRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/CyclomaticComplexityRule.java index a3a1541e84..4c92b1987c 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/CyclomaticComplexityRule.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/CyclomaticComplexityRule.java @@ -8,6 +8,9 @@ import net.sourceforge.pmd.lang.apex.ast.ASTForEachStatement; import net.sourceforge.pmd.lang.apex.ast.ASTForLoopStatement; import net.sourceforge.pmd.lang.apex.ast.ASTIfBlockStatement; import net.sourceforge.pmd.lang.apex.ast.ASTWhileLoopStatement; +import net.sourceforge.pmd.lang.apex.ast.ASTDoLoopStatement; +import net.sourceforge.pmd.lang.apex.ast.ASTTernaryExpression; +import net.sourceforge.pmd.lang.apex.rule.codesize.NPathComplexityRule; /** * @author ported from Java version of Donald A. Leckie, @@ -18,37 +21,57 @@ import net.sourceforge.pmd.lang.apex.ast.ASTWhileLoopStatement; */ public class CyclomaticComplexityRule extends StdCyclomaticComplexityRule { - public Object visit(ASTIfBlockStatement node, Object data) { - super.visit(node, data); + @Override + public Object visit(ASTIfBlockStatement node, Object data) { + super.visit(node, data); - int boolCompIf = NPathComplexityRule.sumExpressionComplexity(node.getFirstChildOfType(ASTExpression.class)); - entryStack.peek().bumpDecisionPoints(boolCompIf); - return data; - } + int boolCompIf = NPathComplexityRule.sumExpressionComplexity(node.getFirstChildOfType(ASTExpression.class)); + entryStack.peek().bumpDecisionPoints(boolCompIf); + return data; + } - public Object visit(ASTForEachStatement node, Object data) { - super.visit(node, data); + @Override + public Object visit(ASTForEachStatement node, Object data) { + super.visit(node, data); - int boolCompFor = NPathComplexityRule - .sumExpressionComplexity(node.getFirstDescendantOfType(ASTExpression.class)); - entryStack.peek().bumpDecisionPoints(boolCompFor); - return data; - } + int boolCompFor = NPathComplexityRule.sumExpressionComplexity(node.getFirstDescendantOfType(ASTExpression.class)); + entryStack.peek().bumpDecisionPoints(boolCompFor); + return data; + } - public Object visit(ASTForLoopStatement node, Object data) { - super.visit(node, data); + @Override + public Object visit(ASTForLoopStatement node, Object data) { + super.visit(node, data); - int boolCompFor = NPathComplexityRule - .sumExpressionComplexity(node.getFirstDescendantOfType(ASTExpression.class)); - entryStack.peek().bumpDecisionPoints(boolCompFor); - return data; - } + int boolCompFor = NPathComplexityRule.sumExpressionComplexity(node.getFirstDescendantOfType(ASTExpression.class)); + entryStack.peek().bumpDecisionPoints(boolCompFor); + return data; + } - public Object visit(ASTWhileLoopStatement node, Object data) { - super.visit(node, data); + @Override + public Object visit(ASTWhileLoopStatement node, Object data) { + super.visit(node, data); - int boolCompWhile = NPathComplexityRule.sumExpressionComplexity(node.getFirstChildOfType(ASTExpression.class)); - entryStack.peek().bumpDecisionPoints(boolCompWhile); - return data; - } + int boolCompWhile = NPathComplexityRule.sumExpressionComplexity(node.getFirstChildOfType(ASTExpression.class)); + entryStack.peek().bumpDecisionPoints(boolCompWhile); + return data; + } + + @Override + public Object visit(ASTDoLoopStatement node, Object data) { + super.visit( node, data ); + + int boolCompDo = NPathComplexityRule.sumExpressionComplexity( node.getFirstChildOfType( ASTExpression.class ) ); + entryStack.peek().bumpDecisionPoints( boolCompDo ); + return data; + } + + @Override + public Object visit(ASTTernaryExpression node, Object data) { + super.visit(node, data); + + int boolCompWhile = NPathComplexityRule.sumExpressionComplexity(node.getFirstChildOfType(ASTExpression.class)); + entryStack.peek().bumpDecisionPoints(boolCompWhile); + return data; + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/ExcessiveClassLengthRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/ExcessiveClassLengthRule.java index 89581531f2..3e2206c90e 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/ExcessiveClassLengthRule.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/ExcessiveClassLengthRule.java @@ -12,8 +12,8 @@ import net.sourceforge.pmd.lang.apex.rule.design.ExcessiveLengthRule; */ public class ExcessiveClassLengthRule extends ExcessiveLengthRule { - public ExcessiveClassLengthRule() { - super(ASTCompilation.class); - setProperty(MINIMUM_DESCRIPTOR, 1000d); - } + public ExcessiveClassLengthRule() { + super(ASTCompilation.class); + setProperty(MINIMUM_DESCRIPTOR, 1000d); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/ExcessiveMethodLengthRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/ExcessiveMethodLengthRule.java index 65baed3033..856a8320c1 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/ExcessiveMethodLengthRule.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/ExcessiveMethodLengthRule.java @@ -11,8 +11,8 @@ import net.sourceforge.pmd.lang.apex.rule.design.ExcessiveLengthRule; * has more than x lines of code. */ public class ExcessiveMethodLengthRule extends ExcessiveLengthRule { - public ExcessiveMethodLengthRule() { - super(ASTMethod.class); - setProperty(MINIMUM_DESCRIPTOR, 100d); - } + public ExcessiveMethodLengthRule() { + super(ASTMethod.class); + setProperty(MINIMUM_DESCRIPTOR, 100d); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/ExcessiveParameterListRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/ExcessiveParameterListRule.java index 1e9dbdc460..6447db3644 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/ExcessiveParameterListRule.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/ExcessiveParameterListRule.java @@ -13,13 +13,14 @@ import net.sourceforge.pmd.util.NumericConstants; * topcount and sigma should work.) */ public class ExcessiveParameterListRule extends ExcessiveNodeCountRule { - public ExcessiveParameterListRule() { - super(ASTParameter.class); - setProperty(MINIMUM_DESCRIPTOR, 10d); - } + public ExcessiveParameterListRule() { + super(ASTParameter.class); + setProperty(MINIMUM_DESCRIPTOR, 10d); + } - // Count these nodes, but no others. - public Object visit(ASTParameter node, Object data) { - return NumericConstants.ONE; - } + // Count these nodes, but no others. + @Override + public Object visit(ASTParameter node, Object data) { + return NumericConstants.ONE; + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/ExcessivePublicCountRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/ExcessivePublicCountRule.java index 4f5914a333..19eb325334 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/ExcessivePublicCountRule.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/ExcessivePublicCountRule.java @@ -31,40 +31,42 @@ import net.sourceforge.pmd.util.NumericConstants; */ public class ExcessivePublicCountRule extends ExcessiveNodeCountRule { - public ExcessivePublicCountRule() { - super(ASTCompilation.class); - setProperty(MINIMUM_DESCRIPTOR, 45d); - } + public ExcessivePublicCountRule() { + super(ASTCompilation.class); + setProperty(MINIMUM_DESCRIPTOR, 45d); + } - /** - * Method counts ONLY public methods. - */ - public Object visit(ASTMethod node, Object data) { - return this.getTallyOnAccessType((AccessNode) node.jjtGetParent()); - } + /** + * Method counts ONLY public methods. + */ + @Override + public Object visit(ASTMethod node, Object data) { + return this.getTallyOnAccessType((AccessNode) node.jjtGetParent()); + } - /** - * Method counts ONLY public class attributes which are not PUBLIC and - * static- these usually represent constants.... - */ - public Object visit(ASTField node, Object data) { - if (node.getNode().getModifierInfo().all(PUBLIC, STATIC)) { - return NumericConstants.ZERO; - } - return this.getTallyOnAccessType((AccessNode) node); - } + /** + * Method counts ONLY public class attributes which are not PUBLIC and + * static- these usually represent constants.... + */ + @Override + public Object visit(ASTField node, Object data) { + if (node.getNode().getModifierInfo().all(PUBLIC, STATIC)) { + return NumericConstants.ZERO; + } + return this.getTallyOnAccessType((AccessNode) node); + } - /** - * Method counts a node if it is public - * - * @param node - * The access node. - * @return Integer 1 if node is public 0 otherwise - */ - private Integer getTallyOnAccessType(AccessNode node) { - if (node.isPublic()) { - return NumericConstants.ONE; - } - return NumericConstants.ZERO; - } + /** + * Method counts a node if it is public + * + * @param node + * The access node. + * @return Integer 1 if node is public 0 otherwise + */ + private Integer getTallyOnAccessType(AccessNode node) { + if (node.isPublic()) { + return NumericConstants.ONE; + } + return NumericConstants.ZERO; + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/NPathComplexityRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/NPathComplexityRule.java index 94caa3d481..f7f6f19170 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/NPathComplexityRule.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/NPathComplexityRule.java @@ -6,10 +6,12 @@ package net.sourceforge.pmd.lang.apex.rule.codesize; import java.util.ArrayList; import java.util.List; +import net.sourceforge.pmd.lang.apex.ast.ASTBooleanExpression; import net.sourceforge.pmd.lang.apex.ast.ASTExpression; import net.sourceforge.pmd.lang.apex.ast.ASTForEachStatement; import net.sourceforge.pmd.lang.apex.ast.ASTForLoopStatement; import net.sourceforge.pmd.lang.apex.ast.ASTIfBlockStatement; +import net.sourceforge.pmd.lang.apex.ast.ASTIfElseBlockStatement; import net.sourceforge.pmd.lang.apex.ast.ASTMethod; import net.sourceforge.pmd.lang.apex.ast.ASTReturnStatement; import net.sourceforge.pmd.lang.apex.ast.ASTStatement; @@ -28,187 +30,211 @@ import net.sourceforge.pmd.util.NumericConstants; */ public class NPathComplexityRule extends AbstractStatisticalApexRule { - public NPathComplexityRule() { - super(); - setProperty(MINIMUM_DESCRIPTOR, 200d); - } + public NPathComplexityRule() { + super(); + setProperty(MINIMUM_DESCRIPTOR, 200d); + } - private int complexityMultipleOf(ApexNode node, int npathStart, Object data) { + private int complexityMultipleOf(ApexNode node, int npathStart, Object data) { - int npath = npathStart; - ApexNode n; + int npath = npathStart; + ApexNode n; - for (int i = 0; i < node.jjtGetNumChildren(); i++) { - n = (ApexNode) node.jjtGetChild(i); - npath *= (Integer) n.jjtAccept(this, data); - } + for (int i = 0; i < node.jjtGetNumChildren(); i++) { + n = (ApexNode) node.jjtGetChild(i); + npath *= (Integer) n.jjtAccept(this, data); + } - return npath; - } + return npath; + } - private int complexitySumOf(ApexNode node, int npathStart, Object data) { + private int complexitySumOf(ApexNode node, int npathStart, Object data) { - int npath = npathStart; - ApexNode n; + int npath = npathStart; + ApexNode n; - for (int i = 0; i < node.jjtGetNumChildren(); i++) { - n = (ApexNode) node.jjtGetChild(i); - npath += (Integer) n.jjtAccept(this, data); - } + for (int i = 0; i < node.jjtGetNumChildren(); i++) { + n = (ApexNode) node.jjtGetChild(i); + npath += (Integer) n.jjtAccept(this, data); + } - return npath; - } + return npath; + } - public Object visit(ASTMethod node, Object data) { - int npath = complexityMultipleOf(node, 1, data); + @Override + public Object visit(ASTMethod node, Object data) { + int npath = complexityMultipleOf(node, 1, data); - DataPoint point = new DataPoint(); - point.setNode(node); - point.setScore(1.0 * npath); - point.setMessage(getMessage()); - addDataPoint(point); + DataPoint point = new DataPoint(); + point.setNode(node); + point.setScore(1.0 * npath); + point.setMessage(getMessage()); + addDataPoint(point); - return Integer.valueOf(npath); - } + return Integer.valueOf(npath); + } - public Object visit(ApexNode node, Object data) { - int npath = complexityMultipleOf(node, 1, data); - return Integer.valueOf(npath); - } + @Override + public Object visit(ApexNode node, Object data) { + int npath = complexityMultipleOf(node, 1, data); + return Integer.valueOf(npath); + } - public Object visit(ASTIfBlockStatement node, Object data) { - // (npath of if + npath of else (or 1) + bool_comp of if) * npath of - // next + @Override + public Object visit(ASTIfElseBlockStatement node, Object data) { + // (npath of if + npath of else (or 1) + bool_comp of if) * npath of + // next - List statementChildren = new ArrayList<>(); - for (int i = 0; i < node.jjtGetNumChildren(); i++) { - if (node.jjtGetChild(i).getClass() == ASTStatement.class) { - statementChildren.add((ApexNode) node.jjtGetChild(i)); - } - } + List statementChildren = new ArrayList<>(); + for (int i = 0; i < node.jjtGetNumChildren(); i++) { + if (node.jjtGetChild(i).getClass() == ASTStatement.class) { + statementChildren.add((ApexNode) node.jjtGetChild(i)); + } + } - if (statementChildren.isEmpty() || statementChildren.size() == 1 && node.hasElse() - || statementChildren.size() != 1 && !node.hasElse()) { - throw new IllegalStateException("If node has wrong number of children"); - } + if (statementChildren.isEmpty() || statementChildren.size() == 1 && true + || statementChildren.size() != 1 && false) { + throw new IllegalStateException("If node has wrong number of children"); + } - // add path for not taking if - int complexity = 0; - if (!node.hasElse()) { - complexity++; - } + // add path for not taking if + int complexity = 1; - for (ApexNode element : statementChildren) { - complexity += (Integer) element.jjtAccept(this, data); - } + for (ApexNode element : statementChildren) { + complexity += (Integer) element.jjtAccept(this, data); + } - int boolCompIf = sumExpressionComplexity(node.getFirstChildOfType(ASTExpression.class)); - return Integer.valueOf(boolCompIf + complexity); - } + int boolCompIf = sumExpressionComplexity(node.getFirstChildOfType(ASTExpression.class)); + return Integer.valueOf(boolCompIf + complexity); + } - public Object visit(ASTWhileLoopStatement node, Object data) { - // (npath of while + bool_comp of while + 1) * npath of next + @Override + public Object visit(ASTIfBlockStatement node, Object data) { + // (npath of if + npath of else (or 1) + bool_comp of if) * npath of + // next - int boolCompWhile = sumExpressionComplexity(node.getFirstChildOfType(ASTExpression.class)); + List statementChildren = new ArrayList<>(); + for (int i = 0; i < node.jjtGetNumChildren(); i++) { + if (node.jjtGetChild(i).getClass() == ASTStatement.class) { + statementChildren.add((ApexNode) node.jjtGetChild(i)); + } + } - Integer nPathWhile = (Integer) ((ApexNode) node.getFirstChildOfType(ASTStatement.class)).jjtAccept(this, data); + if (statementChildren.isEmpty() || statementChildren.size() == 1 && false || statementChildren.size() != 1) { + throw new IllegalStateException("If node has wrong number of children"); + } - return Integer.valueOf(boolCompWhile + nPathWhile + 1); - } + // add path for not taking if + int complexity = 0; - public Object visit(ASTForLoopStatement node, Object data) { - // (npath of for + bool_comp of for + 1) * npath of next + for (ApexNode element : statementChildren) { + complexity += (Integer) element.jjtAccept(this, data); + } - int boolCompFor = sumExpressionComplexity(node.getFirstDescendantOfType(ASTExpression.class)); + int boolCompIf = sumExpressionComplexity(node.getFirstChildOfType(ASTExpression.class)); + return Integer.valueOf(boolCompIf + complexity); + } - Integer nPathFor = (Integer) ((ApexNode) node.getFirstChildOfType(ASTStatement.class)).jjtAccept(this, data); + @Override + public Object visit(ASTWhileLoopStatement node, Object data) { + // (npath of while + bool_comp of while + 1) * npath of next - return Integer.valueOf(boolCompFor + nPathFor + 1); - } + int boolCompWhile = sumExpressionComplexity(node.getFirstChildOfType(ASTExpression.class)); - public Object visit(ASTForEachStatement node, Object data) { - // (npath of for + bool_comp of for + 1) * npath of next + Integer nPathWhile = (Integer) ((ApexNode) node.getFirstChildOfType(ASTStatement.class)).jjtAccept(this, data); - int boolCompFor = sumExpressionComplexity(node.getFirstDescendantOfType(ASTExpression.class)); + return Integer.valueOf(boolCompWhile + nPathWhile + 1); + } - Integer nPathFor = (Integer) ((ApexNode) node.getFirstChildOfType(ASTStatement.class)).jjtAccept(this, data); + @Override + public Object visit(ASTForLoopStatement node, Object data) { + // (npath of for + bool_comp of for + 1) * npath of next - return Integer.valueOf(boolCompFor + nPathFor + 1); - } + int boolCompFor = sumExpressionComplexity(node.getFirstDescendantOfType(ASTExpression.class)); - public Object visit(ASTReturnStatement node, Object data) { - // return statements are valued at 1, or the value of the boolean - // expression + Integer nPathFor = (Integer) ((ApexNode) node.getFirstChildOfType(ASTStatement.class)).jjtAccept(this, data); - ASTExpression expr = node.getFirstChildOfType(ASTExpression.class); + return Integer.valueOf(boolCompFor + nPathFor + 1); + } - if (expr == null) { - return NumericConstants.ONE; - } + public Object visit(ASTForEachStatement node, Object data) { + // (npath of for + bool_comp of for + 1) * npath of next - int boolCompReturn = sumExpressionComplexity(expr); - int conditionalExpressionComplexity = complexityMultipleOf(expr, 1, data); + int boolCompFor = sumExpressionComplexity(node.getFirstDescendantOfType(ASTExpression.class)); - if (conditionalExpressionComplexity > 1) { - boolCompReturn += conditionalExpressionComplexity; - } + Integer nPathFor = (Integer) ((ApexNode) node.getFirstChildOfType(ASTStatement.class)).jjtAccept(this, data); - if (boolCompReturn > 0) { - return Integer.valueOf(boolCompReturn); - } - return NumericConstants.ONE; - } + return Integer.valueOf(boolCompFor + nPathFor + 1); + } - public Object visit(ASTTryCatchFinallyBlockStatement node, Object data) { - /* - * This scenario was not addressed by the original paper. Based on the - * principles outlined in the paper, as well as the Checkstyle NPath - * implementation, this code will add the complexity of the try to the - * complexities of the catch and finally blocks. - */ - int npath = complexitySumOf(node, 0, data); + @Override + public Object visit(ASTReturnStatement node, Object data) { + // return statements are valued at 1, or the value of the boolean + // expression - return Integer.valueOf(npath); + ASTExpression expr = node.getFirstChildOfType(ASTExpression.class); - } + if (expr == null) { + return NumericConstants.ONE; + } - /** - * Calculate the boolean complexity of the given expression. NPath boolean - * complexity is the sum of && and || tokens. This is calculated by summing - * the number of children of the &&'s (minus one) and the children of the - * ||'s (minus one). - *

- * Note that this calculation applies to Cyclomatic Complexity as well. - * - * @param expr - * control structure expression - * @return complexity of the boolean expression - */ - public static int sumExpressionComplexity(ASTExpression expr) { - if (expr == null) { - return 0; - } + int boolCompReturn = sumExpressionComplexity(expr); + int conditionalExpressionComplexity = complexityMultipleOf(expr, 1, data); - List andNodes = expr.findDescendantsOfType(ASTConditionalAndExpression.class); - List orNodes = expr.findDescendantsOfType(ASTConditionalOrExpression.class); + if (conditionalExpressionComplexity > 1) { + boolCompReturn += conditionalExpressionComplexity; + } - int children = 0; + if (boolCompReturn > 0) { + return Integer.valueOf(boolCompReturn); + } + return NumericConstants.ONE; + } - for (ASTConditionalOrExpression element : orNodes) { - children += element.jjtGetNumChildren(); - children--; - } + @Override + public Object visit(ASTTryCatchFinallyBlockStatement node, Object data) { + /* + * This scenario was not addressed by the original paper. Based on the + * principles outlined in the paper, as well as the Checkstyle NPath + * implementation, this code will add the complexity of the try to the + * complexities of the catch and finally blocks. + */ + int npath = complexitySumOf(node, 0, data); - for (ASTConditionalAndExpression element : andNodes) { - children += element.jjtGetNumChildren(); - children--; - } + return Integer.valueOf(npath); - return children; - } + } - @Override - public Object[] getViolationParameters(DataPoint point) { - return new String[] { ((ASTMethod) point.getNode()).getMethodName(), String.valueOf((int) point.getScore()) }; - } + /** + * Calculate the boolean complexity of the given expression. NPath boolean + * complexity is the sum of && and || tokens. This is calculated by summing + * the number of children of the &&'s (minus one) and the children of the + * ||'s (minus one). + *

+ * Note that this calculation applies to Cyclomatic Complexity as well. + * + * @param expr + * control structure expression + * @return complexity of the boolean expression + */ + public static int sumExpressionComplexity(ASTExpression expr) { + if (expr == null) { + return 0; + } + + int children = 0; + + for (ASTBooleanExpression element : expr.findDescendantsOfType(ASTBooleanExpression.class)) { + children += element.jjtGetNumChildren(); + children--; + } + + return children; + } + + @Override + public Object[] getViolationParameters(DataPoint point) { + return new String[] { ((ASTMethod) point.getNode()).getNode().getMethodInfo().getName(), + String.valueOf((int) point.getScore()) }; + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/NcssMethodCountRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/NcssMethodCountRule.java new file mode 100644 index 0000000000..fa2c4e22a4 --- /dev/null +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/NcssMethodCountRule.java @@ -0,0 +1,34 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ +package net.sourceforge.pmd.lang.apex.rule.codesize; + +import net.sourceforge.pmd.lang.apex.ast.ASTMethod; +import net.sourceforge.pmd.stat.DataPoint; + +/** + * Non-commented source statement counter for methods. + * + * @author Jason Bennett + */ +public class NcssMethodCountRule extends AbstractNcssCountRule { + + /** + * Count the size of all non-constructor methods. + */ + public NcssMethodCountRule() { + super(ASTMethod.class); + setProperty(MINIMUM_DESCRIPTOR, 100d); + } + + @Override + public Object visit(ASTMethod node, Object data) { + return super.visit(node, data); + } + + @Override + public Object[] getViolationParameters(DataPoint point) { + return new String[] { ((ASTMethod) point.getNode()).getNode().getMethodInfo().getName(), + String.valueOf((int) point.getScore()) }; + } +} diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/NcssTypeCountRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/NcssTypeCountRule.java new file mode 100644 index 0000000000..24e777862e --- /dev/null +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/NcssTypeCountRule.java @@ -0,0 +1,82 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ +package net.sourceforge.pmd.lang.apex.rule.codesize; + +import net.sourceforge.pmd.lang.apex.ast.ASTUserClass; +import net.sourceforge.pmd.lang.apex.ast.ASTUserInterface; + +import net.sourceforge.pmd.lang.apex.ast.ASTConstructorPreambleStatement; +import net.sourceforge.pmd.lang.apex.ast.ASTUserEnum; +import net.sourceforge.pmd.lang.apex.ast.ASTFieldDeclaration; +import net.sourceforge.pmd.lang.apex.ast.ASTMethod; +import net.sourceforge.pmd.lang.apex.ast.ASTVariableDeclaration; +import net.sourceforge.pmd.stat.DataPoint; +import net.sourceforge.pmd.util.NumericConstants; + +/** + * Non-commented source statement counter for type declarations. + * + * @author Jason Bennett + */ +public class NcssTypeCountRule extends AbstractNcssCountRule { + + /** + * Count type declarations. This includes classes as well as enums and + * annotations. + */ + public NcssTypeCountRule() { + super(ASTVariableDeclaration.class); + setProperty(MINIMUM_DESCRIPTOR, 1500d); + } + + @Override + public Object visit(ASTUserClass node, Object data) { + /* + * if (!node.isNested()) { return super.visit(node, data); } + */ + return countNodeChildren(node, data); + } + + @Override + public Object visit(ASTUserInterface node, Object data) { + /* + * if (!node.getNode.isNested()) { return super.visit(node, data); } + */ + return countNodeChildren(node, data); + } + + @Override + public Object visit(ASTConstructorPreambleStatement node, Object data) { + return countNodeChildren(node, data); + } + + @Override + public Object visit(ASTUserEnum node, Object data) { + /* + * If the enum is a type in and of itself, don't count its declaration + * twice. + */ + if (node.jjtGetParent() instanceof ASTVariableDeclaration) { + Integer nodeCount = countNodeChildren(node, data); + int count = nodeCount.intValue() - 1; + return Integer.valueOf(count); + } + return countNodeChildren(node, data); + } + + @Override + public Object visit(ASTMethod node, Object data) { + return countNodeChildren(node, data); + } + + @Override + public Object visit(ASTFieldDeclaration node, Object data) { + return NumericConstants.ONE; + } + + @Override + public Object[] getViolationParameters(DataPoint point) { + return new String[] { String.valueOf((int) point.getScore()) }; + } +} diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/StdCyclomaticComplexityRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/StdCyclomaticComplexityRule.java index 466ecc44a7..c8b2bfd543 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/StdCyclomaticComplexityRule.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/StdCyclomaticComplexityRule.java @@ -19,6 +19,8 @@ import net.sourceforge.pmd.lang.apex.ast.ASTForEachStatement; import net.sourceforge.pmd.lang.apex.ast.ASTIfBlockStatement; import net.sourceforge.pmd.lang.apex.ast.ASTMethod; import net.sourceforge.pmd.lang.apex.ast.ASTWhileLoopStatement; +import net.sourceforge.pmd.lang.apex.ast.ASTDoLoopStatement; +import net.sourceforge.pmd.lang.apex.ast.ASTTernaryExpression; import net.sourceforge.pmd.lang.apex.rule.AbstractApexRule; import net.sourceforge.pmd.lang.rule.properties.BooleanProperty; import net.sourceforge.pmd.lang.rule.properties.IntegerProperty; @@ -36,154 +38,174 @@ import net.sourceforge.pmd.lang.rule.properties.IntegerProperty; */ public class StdCyclomaticComplexityRule extends AbstractApexRule { - public static final IntegerProperty REPORT_LEVEL_DESCRIPTOR = new IntegerProperty("reportLevel", - "Cyclomatic Complexity reporting threshold", 1, 30, 10, 1.0f); + public static final IntegerProperty REPORT_LEVEL_DESCRIPTOR = new IntegerProperty("reportLevel", + "Cyclomatic Complexity reporting threshold", 1, 30, 10, 1.0f); - public static final BooleanProperty SHOW_CLASSES_COMPLEXITY_DESCRIPTOR = new BooleanProperty( - "showClassesComplexity", "Add class average violations to the report", true, 2.0f); + public static final BooleanProperty SHOW_CLASSES_COMPLEXITY_DESCRIPTOR = new BooleanProperty( + "showClassesComplexity", "Add class average violations to the report", true, 2.0f); - public static final BooleanProperty SHOW_METHODS_COMPLEXITY_DESCRIPTOR = new BooleanProperty( - "showMethodsComplexity", "Add method average violations to the report", true, 3.0f); + public static final BooleanProperty SHOW_METHODS_COMPLEXITY_DESCRIPTOR = new BooleanProperty( + "showMethodsComplexity", "Add method average violations to the report", true, 3.0f); - private int reportLevel; - private boolean showClassesComplexity = true; - private boolean showMethodsComplexity = true; + private int reportLevel; + private boolean showClassesComplexity = true; + private boolean showMethodsComplexity = true; - protected static class Entry { - private Node node; - private int decisionPoints = 1; - public int highestDecisionPoints; - public int methodCount; + protected static class Entry { + private Node node; + private int decisionPoints = 1; + public int highestDecisionPoints; + public int methodCount; - private Entry(Node node) { - this.node = node; - } + private Entry(Node node) { + this.node = node; + } - public void bumpDecisionPoints() { - decisionPoints++; - } + public void bumpDecisionPoints() { + decisionPoints++; + } - public void bumpDecisionPoints(int size) { - decisionPoints += size; - } + public void bumpDecisionPoints(int size) { + decisionPoints += size; + } - public int getComplexityAverage() { - return (double) methodCount == 0 ? 1 : (int) Math.rint((double) decisionPoints / (double) methodCount); - } - } + public int getComplexityAverage() { + return (double) methodCount == 0 ? 1 : (int) Math.rint((double) decisionPoints / (double) methodCount); + } + } - protected Stack entryStack = new Stack<>(); + protected Stack entryStack = new Stack<>(); - public StdCyclomaticComplexityRule() { - definePropertyDescriptor(REPORT_LEVEL_DESCRIPTOR); - definePropertyDescriptor(SHOW_CLASSES_COMPLEXITY_DESCRIPTOR); - definePropertyDescriptor(SHOW_METHODS_COMPLEXITY_DESCRIPTOR); - } + public StdCyclomaticComplexityRule() { + definePropertyDescriptor(REPORT_LEVEL_DESCRIPTOR); + definePropertyDescriptor(SHOW_CLASSES_COMPLEXITY_DESCRIPTOR); + definePropertyDescriptor(SHOW_METHODS_COMPLEXITY_DESCRIPTOR); + } - public Object visit(ASTCompilation node, Object data) { - reportLevel = getProperty(REPORT_LEVEL_DESCRIPTOR); - showClassesComplexity = getProperty(SHOW_CLASSES_COMPLEXITY_DESCRIPTOR); - showMethodsComplexity = getProperty(SHOW_METHODS_COMPLEXITY_DESCRIPTOR); - super.visit(node, data); - return data; - } + @Override + public Object visit(ASTCompilation node, Object data) { + reportLevel = getProperty(REPORT_LEVEL_DESCRIPTOR); + showClassesComplexity = getProperty(SHOW_CLASSES_COMPLEXITY_DESCRIPTOR); + showMethodsComplexity = getProperty(SHOW_METHODS_COMPLEXITY_DESCRIPTOR); + super.visit(node, data); + return data; + } - public Object visit(ASTIfBlockStatement node, Object data) { - entryStack.peek().bumpDecisionPoints(); - super.visit(node, data); - return data; - } + @Override + public Object visit(ASTIfBlockStatement node, Object data) { + entryStack.peek().bumpDecisionPoints(); + super.visit(node, data); + return data; + } - public Object visit(ASTTryCatchFinallyBlockStatement node, Object data) { - entryStack.peek().bumpDecisionPoints(); - super.visit(node, data); - return data; - } + @Override + public Object visit(ASTTryCatchFinallyBlockStatement node, Object data) { + entryStack.peek().bumpDecisionPoints(); + super.visit(node, data); + return data; + } - public Object visit(ASTForLoopStatement node, Object data) { - entryStack.peek().bumpDecisionPoints(); - super.visit(node, data); - return data; - } + @Override + public Object visit(ASTForLoopStatement node, Object data) { + entryStack.peek().bumpDecisionPoints(); + super.visit(node, data); + return data; + } - public Object visit(ASTForEachStatement node, Object data) { - entryStack.peek().bumpDecisionPoints(); - super.visit(node, data); - return data; - } + @Override + public Object visit(ASTForEachStatement node, Object data) { + entryStack.peek().bumpDecisionPoints(); + super.visit(node, data); + return data; + } - public Object visit(ASTWhileLoopStatement node, Object data) { - entryStack.peek().bumpDecisionPoints(); - super.visit(node, data); - return data; - } + @Override + public Object visit(ASTWhileLoopStatement node, Object data) { + entryStack.peek().bumpDecisionPoints(); + super.visit(node, data); + return data; + } + + @Override + public Object visit(ASTDoLoopStatement node, Object data) { + entryStack.peek().bumpDecisionPoints(); + super.visit(node, data); + return data; + } + + @Override + public Object visit(ASTTernaryExpression node, Object data) { + entryStack.peek().bumpDecisionPoints(); + super.visit(node, data); + return data; + } - public Object visit(ASTUserInterface node, Object data) { - return data; - } + @Override + public Object visit(ASTUserInterface node, Object data) { + return data; + } + @Override + public Object visit(ASTUserClass node, Object data) { + entryStack.push(new Entry(node)); + super.visit(node, data); + if (showClassesComplexity) { + Entry classEntry = entryStack.pop(); + if (classEntry.getComplexityAverage() >= reportLevel || classEntry.highestDecisionPoints >= reportLevel) { + addViolation(data, node, new String[] { "class", node.getImage(), + classEntry.getComplexityAverage() + " (Highest = " + classEntry.highestDecisionPoints + ')' }); + } + } + return data; + } - public Object visit(ASTUserClass node, Object data) { - entryStack.push(new Entry(node)); - super.visit(node, data); - if (showClassesComplexity) { - Entry classEntry = entryStack.pop(); - if (classEntry.getComplexityAverage() >= reportLevel || classEntry.highestDecisionPoints >= reportLevel) { - addViolation(data, node, new String[] { "class", node.getImage(), - classEntry.getComplexityAverage() + " (Highest = " + classEntry.highestDecisionPoints + ')' }); - } - } - return data; - } + @Override + public Object visit(ASTMethod node, Object data) { + entryStack.push(new Entry(node)); + super.visit(node, data); + Entry methodEntry = entryStack.pop(); + int methodDecisionPoints = methodEntry.decisionPoints; + Entry classEntry = entryStack.peek(); + classEntry.methodCount++; + classEntry.bumpDecisionPoints(methodDecisionPoints); - public Object visit(ASTMethod node, Object data) { - entryStack.push(new Entry(node)); - super.visit(node, data); - Entry methodEntry = entryStack.pop(); - int methodDecisionPoints = methodEntry.decisionPoints; - Entry classEntry = entryStack.peek(); - classEntry.methodCount++; - classEntry.bumpDecisionPoints(methodDecisionPoints); + if (methodDecisionPoints > classEntry.highestDecisionPoints) { + classEntry.highestDecisionPoints = methodDecisionPoints; + } - if (methodDecisionPoints > classEntry.highestDecisionPoints) { - classEntry.highestDecisionPoints = methodDecisionPoints; - } + if (showMethodsComplexity && methodEntry.decisionPoints >= reportLevel) { + addViolation(data, node, new String[] { "method", "", String.valueOf(methodEntry.decisionPoints) }); + } + return data; + } + @Override + public Object visit(ASTUserEnum node, Object data) { + entryStack.push(new Entry(node)); + super.visit(node, data); + Entry classEntry = entryStack.pop(); + if (classEntry.getComplexityAverage() >= reportLevel || classEntry.highestDecisionPoints >= reportLevel) { + addViolation(data, node, new String[] { "class", node.getImage(), + classEntry.getComplexityAverage() + "(Highest = " + classEntry.highestDecisionPoints + ')' }); + } + return data; + } - if (showMethodsComplexity && methodEntry.decisionPoints >= reportLevel) { - addViolation(data, node, - new String[] { "method", "", - String.valueOf(methodEntry.decisionPoints) }); - } - return data; - } - - public Object visit(ASTUserEnum node, Object data) { - entryStack.push(new Entry(node)); - super.visit(node, data); - Entry classEntry = entryStack.pop(); - if (classEntry.getComplexityAverage() >= reportLevel || classEntry.highestDecisionPoints >= reportLevel) { - addViolation(data, node, new String[] { "class", node.getImage(), - classEntry.getComplexityAverage() + "(Highest = " + classEntry.highestDecisionPoints + ')' }); - } - return data; - } - - public Object visit(ASTConstructorPreambleStatement node, Object data) { - entryStack.push(new Entry(node)); - super.visit(node, data); - Entry constructorEntry = entryStack.pop(); - int constructorDecisionPointCount = constructorEntry.decisionPoints; - Entry classEntry = entryStack.peek(); - classEntry.methodCount++; - classEntry.decisionPoints += constructorDecisionPointCount; - if (constructorDecisionPointCount > classEntry.highestDecisionPoints) { - classEntry.highestDecisionPoints = constructorDecisionPointCount; - } - if (showMethodsComplexity && constructorEntry.decisionPoints >= reportLevel) { - addViolation(data, node, new String[] { "constructor", classEntry.node.getImage(), - String.valueOf(constructorDecisionPointCount) }); - } - return data; - } + public Object visit(ASTConstructorPreambleStatement node, Object data) { + entryStack.push(new Entry(node)); + super.visit(node, data); + Entry constructorEntry = entryStack.pop(); + int constructorDecisionPointCount = constructorEntry.decisionPoints; + Entry classEntry = entryStack.peek(); + classEntry.methodCount++; + classEntry.decisionPoints += constructorDecisionPointCount; + if (constructorDecisionPointCount > classEntry.highestDecisionPoints) { + classEntry.highestDecisionPoints = constructorDecisionPointCount; + } + if (showMethodsComplexity && constructorEntry.decisionPoints >= reportLevel) { + addViolation(data, node, new String[] { "constructor", classEntry.node.getImage(), + String.valueOf(constructorDecisionPointCount) }); + } + return data; + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/TooManyFieldsRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/TooManyFieldsRule.java index 55f6070bbb..3dee00892e 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/TooManyFieldsRule.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/codesize/TooManyFieldsRule.java @@ -21,54 +21,54 @@ import net.sourceforge.pmd.util.NumericConstants; public class TooManyFieldsRule extends AbstractApexRule { - private static final int DEFAULT_MAXFIELDS = 15; + private static final int DEFAULT_MAXFIELDS = 15; - private Map stats; - private Map nodes; + private Map stats; + private Map nodes; - private static final IntegerProperty MAX_FIELDS_DESCRIPTOR = new IntegerProperty("maxfields", - "Max allowable fields", 1, 300, DEFAULT_MAXFIELDS, 1.0f); + private static final IntegerProperty MAX_FIELDS_DESCRIPTOR = new IntegerProperty("maxfields", + "Max allowable fields", 1, 300, DEFAULT_MAXFIELDS, 1.0f); - public TooManyFieldsRule() { - definePropertyDescriptor(MAX_FIELDS_DESCRIPTOR); - } + public TooManyFieldsRule() { + definePropertyDescriptor(MAX_FIELDS_DESCRIPTOR); + } - @Override - public Object visit(ASTUserClass node, Object data) { + @Override + public Object visit(ASTUserClass node, Object data) { - int maxFields = getProperty(MAX_FIELDS_DESCRIPTOR); + int maxFields = getProperty(MAX_FIELDS_DESCRIPTOR); - stats = new HashMap<>(5); - nodes = new HashMap<>(5); + stats = new HashMap<>(5); + nodes = new HashMap<>(5); - List l = node.findDescendantsOfType(ASTField.class); + List l = node.findDescendantsOfType(ASTField.class); - for (ASTField fd : l) { - if (fd.getNode().getModifierInfo().all(FINAL, STATIC)) { - continue; - } - ASTCompilation clazz = fd.getFirstParentOfType(ASTCompilation.class); - if (clazz != null && !(clazz.getNode() instanceof UserInterface)) { - bumpCounterFor(clazz); - } - } - for (String k : stats.keySet()) { - int val = stats.get(k); - Node n = nodes.get(k); - if (val > maxFields) { - addViolation(data, n); - } - } - return data; - } + for (ASTField fd : l) { + if (fd.getNode().getModifierInfo().all(FINAL, STATIC)) { + continue; + } + ASTCompilation clazz = fd.getFirstParentOfType(ASTCompilation.class); + if (clazz != null && !(clazz.getNode() instanceof UserInterface)) { + bumpCounterFor(clazz); + } + } + for (String k : stats.keySet()) { + int val = stats.get(k); + Node n = nodes.get(k); + if (val > maxFields) { + addViolation(data, n); + } + } + return data; + } - private void bumpCounterFor(ASTCompilation clazz) { - String key = clazz.getImage(); - if (!stats.containsKey(key)) { - stats.put(key, NumericConstants.ZERO); - nodes.put(key, clazz); - } - Integer i = Integer.valueOf(stats.get(key) + 1); - stats.put(key, i); - } + private void bumpCounterFor(ASTCompilation clazz) { + String key = clazz.getImage(); + if (!stats.containsKey(key)) { + stats.put(key, NumericConstants.ZERO); + nodes.put(key, clazz); + } + Integer i = Integer.valueOf(stats.get(key) + 1); + stats.put(key, i); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/design/ExcessiveLengthRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/design/ExcessiveLengthRule.java index daf6c4bb6e..c3533d8136 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/design/ExcessiveLengthRule.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/design/ExcessiveLengthRule.java @@ -16,22 +16,22 @@ import net.sourceforge.pmd.stat.DataPoint; * to check, and this does the rest for you. */ public class ExcessiveLengthRule extends AbstractStatisticalApexRule { - private Class nodeClass; + private Class nodeClass; - public ExcessiveLengthRule(Class nodeClass) { - this.nodeClass = nodeClass; - } + public ExcessiveLengthRule(Class nodeClass) { + this.nodeClass = nodeClass; + } - @Override - public Object visit(ApexNode node, Object data) { - if (nodeClass.isInstance(node)) { - DataPoint point = new DataPoint(); - point.setNode(node); - point.setScore(1.0 * (node.getEndLine() - node.getBeginLine())); - point.setMessage(getMessage()); - addDataPoint(point); - } + @Override + public Object visit(ApexNode node, Object data) { + if (nodeClass.isInstance(node)) { + DataPoint point = new DataPoint(); + point.setNode(node); + point.setScore(1.0 * (node.getEndLine() - node.getBeginLine())); + point.setMessage(getMessage()); + addDataPoint(point); + } - return node.childrenAccept(this, data); - } + return node.childrenAccept(this, data); + } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/design/ExcessiveNodeCountRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/design/ExcessiveNodeCountRule.java index 1c207a84ed..dfff134ef2 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/design/ExcessiveNodeCountRule.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/design/ExcessiveNodeCountRule.java @@ -21,29 +21,29 @@ import net.sourceforge.pmd.stat.DataPoint; */ public class ExcessiveNodeCountRule extends AbstractStatisticalApexRule { - private Class nodeClass; + private Class nodeClass; - public ExcessiveNodeCountRule(Class nodeClass) { - this.nodeClass = nodeClass; - } + public ExcessiveNodeCountRule(Class nodeClass) { + this.nodeClass = nodeClass; + } - @Override - public Object visit(ApexNode node, Object data) { - int numNodes = 0; + @Override + public Object visit(ApexNode node, Object data) { + int numNodes = 0; - for (int i = 0; i < node.jjtGetNumChildren(); i++) { - Integer treeSize = (Integer) ((ApexNode) node.jjtGetChild(i)).jjtAccept(this, data); - numNodes += treeSize; - } + for (int i = 0; i < node.jjtGetNumChildren(); i++) { + Integer treeSize = (Integer) ((ApexNode) node.jjtGetChild(i)).jjtAccept(this, data); + numNodes += treeSize; + } - if (nodeClass.isInstance(node)) { - DataPoint point = new DataPoint(); - point.setNode(node); - point.setScore(1.0 * numNodes); - point.setMessage(getMessage()); - addDataPoint(point); - } + if (nodeClass.isInstance(node)) { + DataPoint point = new DataPoint(); + point.setNode(node); + point.setScore(1.0 * numNodes); + point.setMessage(getMessage()); + addDataPoint(point); + } - return Integer.valueOf(numNodes); - } + return Integer.valueOf(numNodes); + } } diff --git a/pmd-apex/src/main/resources/rulesets/apex/codesize.xml b/pmd-apex/src/main/resources/rulesets/apex/codesize.xml index 2643f48346..805c6b0403 100644 --- a/pmd-apex/src/main/resources/rulesets/apex/codesize.xml +++ b/pmd-apex/src/main/resources/rulesets/apex/codesize.xml @@ -249,62 +249,6 @@ public class Foo { // This has a Cyclomatic Complexity = 12 - - - - - 3 - - - - - - - - - - -This rule uses the NCSS (Non-Commenting Source Statements) algorithm to determine the number of lines -of code for a given constructor. NCSS ignores comments, and counts actual statements. Using this algorithm, -lines of code that are split are counted as one. - - 3 - - methods = rootNode.findDescendantsOfType(ASTMethod.class); - assertEquals(4, methods.size()); - } + // Verify + List methods = rootNode.findDescendantsOfType(ASTMethod.class); + assertEquals(4, methods.size()); + } - @Test - public void parsesRealWorldClasses() { - try { - File directory = new File("src/test/resources"); - File[] fList = directory.listFiles(); + @Test + public void parsesRealWorldClasses() { + try { + File directory = new File("src/test/resources"); + File[] fList = directory.listFiles(); - for (File file : fList) { - if (file.isFile()) { - String sourceCode = FileUtils.readFileToString(file); - ASTUserClass rootNode = parse(sourceCode); - } - } - } catch (IOException e) { - Assert.fail(); - } + for (File file : fList) { + if (file.isFile()) { + String sourceCode = FileUtils.readFileToString(file); + ASTUserClass rootNode = parse(sourceCode); + } + } + } + catch (IOException e) { + Assert.fail(); + } - } + } - // TEST HELPER + // TEST HELPER - private ASTUserClass parse(String code) { - ApexParser parser = new ApexParser(new ApexParserOptions()); - Reader reader = new StringReader(code); - return (ASTUserClass) parser.parse(reader); - } + private ASTUserClass parse(String code) { + ApexParser parser = new ApexParser(new ApexParserOptions()); + Reader reader = new StringReader(code); + return (ASTUserClass) parser.parse(reader); + } - private void dumpNode(Node node) { - DumpFacade facade = new DumpFacade(); - StringWriter writer = new StringWriter(); - facade.initializeWith(writer, "", true, (ApexNode) node); - facade.visit((ApexNode) node, ""); - System.out.println(writer.toString()); - } + private void dumpNode(Node node) { + DumpFacade facade = new DumpFacade(); + StringWriter writer = new StringWriter(); + facade.initializeWith(writer, "", true, (ApexNode) node); + facade.visit((ApexNode) node, ""); + System.out.println(writer.toString()); + } } diff --git a/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/rule/codesize/CodesizeRulesTest.java b/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/rule/codesize/CodesizeRulesTest.java index 72eede98df..4e897cbca9 100644 --- a/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/rule/codesize/CodesizeRulesTest.java +++ b/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/rule/codesize/CodesizeRulesTest.java @@ -7,22 +7,20 @@ import net.sourceforge.pmd.testframework.SimpleAggregatorTst; public class CodesizeRulesTest extends SimpleAggregatorTst { - private static final String RULESET = "apex-codesize"; + private static final String RULESET = "apex-codesize"; - @Override - public void setUp() { - addRule(RULESET, "CyclomaticComplexity"); - addRule(RULESET, "ExcessivePublicCount"); - addRule(RULESET, "ExcessiveClassLength"); - addRule(RULESET, "ExcessiveParameterList"); - addRule(RULESET, "ExcessiveMethodLength"); - addRule(RULESET, "ModifiedCyclomaticComplexity"); - addRule(RULESET, "NcssConstructorCount"); - addRule(RULESET, "NcssMethodCount"); - addRule(RULESET, "NcssTypeCount"); - addRule(RULESET, "NPathComplexity"); - addRule(RULESET, "StdCyclomaticComplexity"); - addRule(RULESET, "TooManyFields"); - addRule(RULESET, "TooManyMethods"); - } + @Override + public void setUp() { + addRule(RULESET, "CyclomaticComplexity"); + addRule(RULESET, "ExcessivePublicCount"); + addRule(RULESET, "ExcessiveClassLength"); + addRule(RULESET, "ExcessiveParameterList"); + addRule(RULESET, "ExcessiveMethodLength"); + addRule(RULESET, "NcssMethodCount"); + addRule(RULESET, "NcssTypeCount"); + addRule(RULESET, "NPathComplexity"); + addRule(RULESET, "StdCyclomaticComplexity"); + addRule(RULESET, "TooManyFields"); + addRule(RULESET, "TooManyMethods"); + } } diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/codesize/xml/CyclomaticComplexity.xml b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/codesize/xml/CyclomaticComplexity.xml index 2cf2f0ba25..79d008bf5f 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/codesize/xml/CyclomaticComplexity.xml +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/codesize/xml/CyclomaticComplexity.xml @@ -4,19 +4,19 @@ - - - - 13 - 0 - - - - - 13 - 0 - - - - - - 13 - 1 - - - - - - 14 - 0 - - - diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/codesize/xml/StdCyclomaticComplexity.xml b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/codesize/xml/StdCyclomaticComplexity.xml index c04b22424e..3592ca9be4 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/codesize/xml/StdCyclomaticComplexity.xml +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/codesize/xml/StdCyclomaticComplexity.xml @@ -4,19 +4,19 @@