Fix PMD issues in core and test

This commit is contained in:
Andreas Dangel
2022-01-28 11:44:54 +01:00
parent 3f2b1b031a
commit 77f01f683d
3 changed files with 4 additions and 9 deletions

View File

@ -80,13 +80,7 @@ import org.apache.commons.lang3.StringUtils;
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
return obj instanceof PropertyDescriptor
return this == obj || obj instanceof PropertyDescriptor
&& name.equals(((PropertyDescriptor<?>) obj).name());
}

View File

@ -352,7 +352,7 @@ public abstract class AbstractRuleSetFactoryTest {
file = file.replaceAll("xsi:schemaLocation=\"" + rulesetNamespace
+ " https://pmd.sourceforge.io/ruleset_\\d_0_0.xsd\"", "");
if (rulesetNamespace.equals(RuleSetWriter.RULESET_2_0_0_NS_URI)) {
if (RuleSetWriter.RULESET_2_0_0_NS_URI.equals(rulesetNamespace)) {
file = "<?xml version=\"1.0\"?>" + PMD.EOL + "<!DOCTYPE ruleset SYSTEM "
+ "\"https://pmd.sourceforge.io/ruleset_2_0_0.dtd\">" + PMD.EOL + file;
} else {

View File

@ -10,6 +10,7 @@ import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.junit.After;
import org.junit.Before;
@ -34,7 +35,7 @@ import net.sourceforge.pmd.Rule;
* @author Andreas Dangel
*/
public class RuleTestRunner extends ParentRunner<TestDescriptor> {
private ConcurrentHashMap<TestDescriptor, Description> testDescriptions = new ConcurrentHashMap<>();
private ConcurrentMap<TestDescriptor, Description> testDescriptions = new ConcurrentHashMap<>();
private final RuleTst instance;
/* default */ RuleTestRunner(final Class<? extends RuleTst> testClass) throws InitializationError {