diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactory.java b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactory.java index 43e27de5ba..11bf9fe36d 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactory.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactory.java @@ -190,7 +190,7 @@ public class RuleSetFactory { List references = RuleSetReferenceId.parse(referenceString); if (references.isEmpty()) { throw new RuleSetNotFoundException( - "No RuleSetReferenceId can be parsed from the string: <" + referenceString + ">"); + "No RuleSetReferenceId can be parsed from the string: <" + referenceString + '>'); } return createRuleSet(references.get(0)); } @@ -620,7 +620,7 @@ public class RuleSetFactory { if (referencedRule instanceof RuleReference) { RuleReference ruleReference = (RuleReference) referencedRule; if (LOG.isLoggable(Level.WARNING)) { - LOG.warning("Use Rule name " + ruleReference.getRuleSetReference().getRuleSetFileName() + "/" + LOG.warning("Use Rule name " + ruleReference.getRuleSetReference().getRuleSetFileName() + '/' + ruleReference.getOriginalName() + " instead of the deprecated Rule name " + otherRuleSetReferenceId + ". PMD " + PMDVersion.getNextMajorRelease() @@ -650,9 +650,9 @@ public class RuleSetFactory { if (warnDeprecated && ruleReference.isDeprecated()) { if (LOG.isLoggable(Level.WARNING)) { - LOG.warning("Use Rule name " + ruleReference.getRuleSetReference().getRuleSetFileName() + "/" + LOG.warning("Use Rule name " + ruleReference.getRuleSetReference().getRuleSetFileName() + '/' + ruleReference.getOriginalName() + " instead of the deprecated Rule name " - + ruleSetReferenceId.getRuleSetFileName() + "/" + ruleReference.getName() + + ruleSetReferenceId.getRuleSetFileName() + '/' + ruleReference.getName() + ". PMD " + PMDVersion.getNextMajorRelease() + " will remove support for this deprecated Rule name usage."); } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetReferenceId.java b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetReferenceId.java index 2f49c29b50..69458994a0 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetReferenceId.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetReferenceId.java @@ -251,7 +251,7 @@ public class RuleSetReferenceId { int index = name.indexOf('-'); if (index >= 0) { // Standard short name - result = "rulesets/" + name.substring(0, index) + "/" + name.substring(index + 1) + ".xml"; + result = "rulesets/" + name.substring(0, index) + '/' + name.substring(index + 1) + ".xml"; } else { // A release RuleSet? if (name.matches("[0-9]+.*")) { @@ -428,7 +428,7 @@ public class RuleSetReferenceId { if (allRules) { return ruleSetFileName; } else { - return ruleSetFileName + "/" + ruleName; + return ruleSetFileName + '/' + ruleName; } } else { diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetWriter.java b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetWriter.java index 0081100627..7f7fa97406 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetWriter.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetWriter.java @@ -177,7 +177,7 @@ public class RuleSetWriter { LanguageVersion maximumLanguageVersion = ruleReference.getOverriddenMaximumLanguageVersion(); Boolean deprecated = ruleReference.isOverriddenDeprecated(); String name = ruleReference.getOverriddenName(); - String ref = ruleReference.getRuleSetReference().getRuleSetFileName() + "/" + String ref = ruleReference.getRuleSetReference().getRuleSetFileName() + '/' + ruleReference.getRule().getName(); String message = ruleReference.getOverriddenMessage(); String externalInfoUrl = ruleReference.getOverriddenExternalInfoUrl(); diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RulesetsFactoryUtils.java b/pmd-core/src/main/java/net/sourceforge/pmd/RulesetsFactoryUtils.java index c17fd98215..840b50fbc4 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/RulesetsFactoryUtils.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/RulesetsFactoryUtils.java @@ -37,7 +37,7 @@ public final class RulesetsFactoryUtils { ruleSets = factory.createRuleSets(rulesets); printRuleNamesInDebug(ruleSets); if (ruleSets.ruleCount() == 0) { - String msg = "No rules found. Maybe you mispelled a rule name? (" + rulesets + ")"; + String msg = "No rules found. Maybe you mispelled a rule name? (" + rulesets + ')'; LOG.log(Level.SEVERE, msg); throw new IllegalArgumentException(msg); } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/ant/internal/PMDTaskImpl.java b/pmd-core/src/main/java/net/sourceforge/pmd/ant/internal/PMDTaskImpl.java index 734fbf2d51..e8928d5a7f 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/ant/internal/PMDTaskImpl.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/ant/internal/PMDTaskImpl.java @@ -85,9 +85,9 @@ public class PMDTaskImpl { SourceLanguage version = task.getSourceLanguage(); if (version != null) { LanguageVersion languageVersion = LanguageRegistry - .findLanguageVersionByTerseName(version.getName() + " " + version.getVersion()); + .findLanguageVersionByTerseName(version.getName() + ' ' + version.getVersion()); if (languageVersion == null) { - throw new BuildException("The following language is not supported:" + version + "."); + throw new BuildException("The following language is not supported:" + version + '.'); } configuration.setDefaultLanguageVersion(languageVersion); } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDParameters.java b/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDParameters.java index acf68c391c..0ff46ddb50 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDParameters.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDParameters.java @@ -167,7 +167,7 @@ public class PMDParameters { configuration.setAnalysisCacheLocation(params.cacheLocation); LanguageVersion languageVersion = LanguageRegistry - .findLanguageVersionByTerseName(params.getLanguage() + " " + params.getVersion()); + .findLanguageVersionByTerseName(params.getLanguage() + ' ' + params.getVersion()); if (languageVersion != null) { configuration.getLanguageVersionDiscoverer().setDefaultLanguageVersion(languageVersion); } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/GUI.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/GUI.java index c706d8037c..322e0366e4 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/GUI.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/GUI.java @@ -636,7 +636,7 @@ public class GUI implements CPDListener { int separatorPos = sourceId.lastIndexOf(File.separatorChar); label = "..." + sourceId.substring(separatorPos); } else { - label = "(" + sourceIDs.size() + " separate files)"; + label = '(' + sourceIDs.size() + " separate files)"; } match.setLabel(label); diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/SimpleRenderer.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/SimpleRenderer.java index dc2d4ef38b..b755b52bb2 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/SimpleRenderer.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/SimpleRenderer.java @@ -46,7 +46,7 @@ public class SimpleRenderer implements Renderer { String source = match.getSourceCodeSlice(); if (trimLeadingWhitespace) { - String[] lines = source.split("[" + PMD.EOL + "]"); + String[] lines = source.split('[' + PMD.EOL + ']'); int trimDepth = StringUtil.maxCommonLeadingWhitespaceForAll(lines); if (trimDepth > 0) { lines = StringUtil.trimStartOn(lines, trimDepth); diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/MemberNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/MemberNode.java index 8f85abe991..01996dc4ea 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/MemberNode.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/MemberNode.java @@ -81,7 +81,7 @@ public abstract class MemberNode, T extends Member> @Override public String toString() { - return name + " " + desc; + return name + ' ' + desc; } public String toStringLong() { diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/BaseLanguageModule.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/BaseLanguageModule.java index 8b7827c247..d02b956dda 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/BaseLanguageModule.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/BaseLanguageModule.java @@ -99,7 +99,7 @@ public abstract class BaseLanguageModule implements Language { @Override public String toString() { - return "LanguageModule:" + name + "(" + this.getClass().getSimpleName() + ")"; + return "LanguageModule:" + name + '(' + this.getClass().getSimpleName() + ')'; } @Override diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/Attribute.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/Attribute.java index 07a0eaa3cc..9e2de28f7a 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/Attribute.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/Attribute.java @@ -75,6 +75,6 @@ public class Attribute { @Override public String toString() { - return name + ":" + getValue() + ":" + parent; + return name + ':' + getValue() + ':' + parent; } } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/VariableAccess.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/VariableAccess.java index dca5da4676..2676138530 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/VariableAccess.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/VariableAccess.java @@ -51,13 +51,13 @@ public class VariableAccess { @Override public String toString() { if (isDefinition()) { - return "Definition(" + variableName + ")"; + return "Definition(" + variableName + ')'; } if (isReference()) { - return "Reference(" + variableName + ")"; + return "Reference(" + variableName + ')'; } if (isUndefinition()) { - return "Undefinition(" + variableName + ")"; + return "Undefinition(" + variableName + ')'; } throw new RuntimeException("Access type was never set"); } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/ImportWrapper.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/ImportWrapper.java index adee83c793..b094c383a8 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/ImportWrapper.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/ImportWrapper.java @@ -101,6 +101,6 @@ public class ImportWrapper { @Override public String toString() { - return "Import[name=" + name + ",fullname=" + fullname + ",static*=" + isStaticDemand + "]"; + return "Import[name=" + name + ",fullname=" + fullname + ",static*=" + isStaticDemand + ']'; } } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/properties/AbstractProperty.java b/pmd-core/src/main/java/net/sourceforge/pmd/properties/AbstractProperty.java index 935d8e4b66..ab1815ddef 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/properties/AbstractProperty.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/properties/AbstractProperty.java @@ -100,9 +100,9 @@ import org.apache.commons.lang3.StringUtils; @Override public String toString() { - return "[PropertyDescriptor: name=" + name() + "," - + " type=" + (isMultiValue() ? "List<" + type() + ">" : type()) + "," - + " value=" + defaultValue() + "]"; + return "[PropertyDescriptor: name=" + name() + ',' + + " type=" + (isMultiValue() ? "List<" + type() + '>' : type()) + ',' + + " value=" + defaultValue() + ']'; }