This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new c0d4ef2 Prefer JDK built-in methods for string joining (#646)
c0d4ef2 is described below
commit c0d4ef222a0a1cb781a91cbd53918b4505a4442a
Author: Elliotte Rusty Harold <[email protected]>
AuthorDate: Sat Jul 5 14:58:35 2025 -0400
Prefer JDK built-in methods for string joining (#646)
---
.../java/org/apache/maven/plugins/pmd/AbstractPmdReport.java | 9 ++++-----
src/main/java/org/apache/maven/plugins/pmd/PmdReport.java | 3 +--
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java
b/src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java
index 2349f5d..780599b 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java
@@ -41,7 +41,6 @@ import org.apache.maven.project.MavenProject;
import org.apache.maven.reporting.AbstractMavenReport;
import org.apache.maven.reporting.MavenReportException;
import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.StringUtils;
/**
* Base class for the PMD reports.
@@ -390,7 +389,7 @@ public abstract class AbstractPmdReport extends
AbstractMavenReport {
/**
* Gets the comma separated list of effective include patterns.
*
- * @return The comma separated list of effective include patterns, never
<code>null</code>.
+ * @return the comma separated list of effective include patterns, never
<code>null</code>.
*/
private String getIncludes() {
Collection<String> patterns = new LinkedHashSet<>();
@@ -400,20 +399,20 @@ public abstract class AbstractPmdReport extends
AbstractMavenReport {
if (patterns.isEmpty()) {
patterns.add("**/*.java");
}
- return StringUtils.join(patterns.iterator(), ",");
+ return String.join(",", patterns);
}
/**
* Gets the comma separated list of effective exclude patterns.
*
- * @return The comma separated list of effective exclude patterns, never
<code>null</code>.
+ * @return the comma separated list of effective exclude patterns, never
<code>null</code>.
*/
private String getExcludes() {
Collection<String> patterns = new
LinkedHashSet<>(FileUtils.getDefaultExcludesAsList());
if (excludes != null) {
patterns.addAll(excludes);
}
- return StringUtils.join(patterns.iterator(), ",");
+ return String.join(",", patterns);
}
protected boolean isXml() {
diff --git a/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
b/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
index a6dca73..ba8ebc4 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
@@ -43,7 +43,6 @@ import org.codehaus.plexus.resource.ResourceManager;
import org.codehaus.plexus.resource.loader.FileResourceCreationException;
import org.codehaus.plexus.resource.loader.FileResourceLoader;
import org.codehaus.plexus.resource.loader.ResourceNotFoundException;
-import org.codehaus.plexus.util.StringUtils;
/**
* Creates a PMD site report based on the rulesets and configuration set in
the plugin.
@@ -492,7 +491,7 @@ public class PmdReport extends AbstractPmdReport {
getLog().debug("Using aux classpath: " + classpath);
}
- return StringUtils.join(classpath.iterator(), File.pathSeparator);
+ return String.join(File.pathSeparator, classpath);
} catch (Exception e) {
throw new MavenReportException(e.getMessage(), e);
}