Skip to content

Commit a992c5c

Browse files
committed
Prefer JDK built-in methods for string joining
1 parent 2bc5682 commit a992c5c

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import org.apache.maven.reporting.AbstractMavenReport;
4242
import org.apache.maven.reporting.MavenReportException;
4343
import org.codehaus.plexus.util.FileUtils;
44-
import org.codehaus.plexus.util.StringUtils;
4544

4645
/**
4746
* Base class for the PMD reports.
@@ -390,7 +389,7 @@ private boolean isDirectoryExcluded(Collection<File> excludedRootFiles, File sou
390389
/**
391390
* Gets the comma separated list of effective include patterns.
392391
*
393-
* @return The comma separated list of effective include patterns, never <code>null</code>.
392+
* @return the comma separated list of effective include patterns, never <code>null</code>.
394393
*/
395394
private String getIncludes() {
396395
Collection<String> patterns = new LinkedHashSet<>();
@@ -400,20 +399,20 @@ private String getIncludes() {
400399
if (patterns.isEmpty()) {
401400
patterns.add("**/*.java");
402401
}
403-
return StringUtils.join(patterns.iterator(), ",");
402+
return String.join(",", patterns);
404403
}
405404

406405
/**
407406
* Gets the comma separated list of effective exclude patterns.
408407
*
409-
* @return The comma separated list of effective exclude patterns, never <code>null</code>.
408+
* @return the comma separated list of effective exclude patterns, never <code>null</code>.
410409
*/
411410
private String getExcludes() {
412411
Collection<String> patterns = new LinkedHashSet<>(FileUtils.getDefaultExcludesAsList());
413412
if (excludes != null) {
414413
patterns.addAll(excludes);
415414
}
416-
return StringUtils.join(patterns.iterator(), ",");
415+
return String.join(",", patterns);
417416
}
418417

419418
protected boolean isXml() {

src/main/java/org/apache/maven/plugins/pmd/PmdReport.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import org.codehaus.plexus.resource.loader.FileResourceCreationException;
4444
import org.codehaus.plexus.resource.loader.FileResourceLoader;
4545
import org.codehaus.plexus.resource.loader.ResourceNotFoundException;
46-
import org.codehaus.plexus.util.StringUtils;
4746

4847
/**
4948
* Creates a PMD site report based on the rulesets and configuration set in the plugin.
@@ -492,7 +491,7 @@ private String determineAuxClasspath() throws MavenReportException {
492491

493492
getLog().debug("Using aux classpath: " + classpath);
494493
}
495-
return StringUtils.join(classpath.iterator(), File.pathSeparator);
494+
return String.join(File.pathSeparator, classpath);
496495
} catch (Exception e) {
497496
throw new MavenReportException(e.getMessage(), e);
498497
}

0 commit comments

Comments
 (0)