From 4f8d09460cfbf57c0e2f82663496d9ea6c121177 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 27 Jan 2024 18:56:19 +0100 Subject: [PATCH] [core] FileCollector - factories stay internal, other methods are now public api Refs #4348 --- .../pmd/lang/document/FileCollector.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/document/FileCollector.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/document/FileCollector.java index 3d0ab591aa..7b7db06c86 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/document/FileCollector.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/document/FileCollector.java @@ -73,12 +73,8 @@ public final class FileCollector implements AutoCloseable { LOG.debug("Created new FileCollector with {}", discoverer); } - public void setRecursive(boolean collectFilesRecursively) { - this.recursive = collectFilesRecursively; - } - /** - * Internal API: please use {@link PmdAnalysis#files()} instead of + * @apiNote Internal API - please use {@link PmdAnalysis#files()} instead of * creating a collector yourself. */ @InternalApi @@ -87,7 +83,10 @@ public final class FileCollector implements AutoCloseable { } /** - * Returns a new collector using the configuration except for the logger. + * Returns a new collector using the same configuration except for the logger. + * + * @apiNote Internal API - please use {@link PmdAnalysis#files()} instead of + * creating a collector yourself. */ @InternalApi public FileCollector newCollector(PmdReporter logger) { @@ -101,9 +100,8 @@ public final class FileCollector implements AutoCloseable { /** * Returns an unmodifiable list of all files that have been collected. * - *

Internal: This might be unstable until PMD 7, but it's internal. + * @throws IllegalStateException if the collector was already closed */ - @InternalApi public List getCollectedFiles() { if (closed) { throw new IllegalStateException("Collector was closed!"); @@ -117,7 +115,6 @@ public final class FileCollector implements AutoCloseable { /** * Returns the reporter for the file collection phase. */ - @InternalApi public PmdReporter getReporter() { return reporter; } @@ -397,6 +394,10 @@ public final class FileCollector implements AutoCloseable { // configuration + public void setRecursive(boolean collectFilesRecursively) { + this.recursive = collectFilesRecursively; + } + /** * Sets the charset to use for subsequent calls to {@link #addFile(Path)} * and other overloads using a {@link Path}.