Fix PMD dogfood: UncommentedEmptyMethodBody, SimplifyBooleanReturns,

UnnecessaryLocalBeforeReturn, OptimizableToArrayCall,
ClassWithOnlyPrivateConstructorsShouldBeFinal,
UseLocaleWithCaseConversions, NonStaticInitializer, UseCollectionIsEmpty
This commit is contained in:
Andreas Dangel
2018-03-10 12:04:50 +01:00
parent 5b93b14373
commit 8bd1e3b486
143 changed files with 522 additions and 723 deletions

View File

@ -12,14 +12,12 @@ import net.sourceforge.pmd.lang.ParserOptions;
import net.sourceforge.pmd.lang.VisitorStarter;
import net.sourceforge.pmd.lang.XPathHandler;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.ast.xpath.AbstractASTXPathHandler;
import net.sourceforge.pmd.lang.ast.xpath.DefaultASTXPathHandler;
import net.sourceforge.pmd.lang.ecmascript.ast.DumpFacade;
import net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptNode;
import net.sourceforge.pmd.lang.ecmascript.rule.EcmascriptRuleViolationFactory;
import net.sourceforge.pmd.lang.rule.RuleViolationFactory;
import net.sf.saxon.sxpath.IndependentContext;
/**
* Implementation of LanguageVersionHandler for the ECMAScript Version 3.
*/
@ -27,13 +25,7 @@ public class Ecmascript3Handler extends AbstractLanguageVersionHandler {
@Override
public XPathHandler getXPathHandler() {
return new AbstractASTXPathHandler() {
public void initialize() {
}
public void initialize(IndependentContext context) {
}
};
return new DefaultASTXPathHandler();
}
public RuleViolationFactory getRuleViolationFactory() {

View File

@ -4,13 +4,15 @@
package net.sourceforge.pmd.lang.ecmascript.ast;
import java.util.Locale;
import org.mozilla.javascript.Token;
import org.mozilla.javascript.ast.KeywordLiteral;
public class ASTKeywordLiteral extends AbstractEcmascriptNode<KeywordLiteral> {
public ASTKeywordLiteral(KeywordLiteral keywordLiteral) {
super(keywordLiteral);
super.setImage(Token.typeToName(keywordLiteral.getType()).toLowerCase());
super.setImage(Token.typeToName(keywordLiteral.getType()).toLowerCase(Locale.ROOT));
}
/**

View File

@ -4,13 +4,15 @@
package net.sourceforge.pmd.lang.ecmascript.ast;
import java.util.Locale;
import org.mozilla.javascript.Token;
import org.mozilla.javascript.ast.VariableDeclaration;
public class ASTVariableDeclaration extends AbstractEcmascriptNode<VariableDeclaration> {
public ASTVariableDeclaration(VariableDeclaration variableDeclaration) {
super(variableDeclaration);
super.setImage(Token.typeToName(variableDeclaration.getType()).toLowerCase());
super.setImage(Token.typeToName(variableDeclaration.getType()).toLowerCase(Locale.ROOT));
}
/**