[core] Hide internal API methods in LanguageProcessor.AnalysisTask
Refs #4348
This commit is contained in:
@ -172,6 +172,9 @@ package or made (package) private and are _not accessible_ anymore.
|
||||
* `net.sourceforge.pmd.util.ResourceLoader` (moved to internal)
|
||||
* {%jdoc !!core::cpd.Tokens %}
|
||||
* Constructor is now package private.
|
||||
* {%jdoc !!core::lang.LanguageProcessor.AnalysisTask %}
|
||||
* Constructor is now package private.
|
||||
* Method `withFiles(java.util.List)` is now package private. Note: it was not previously marked with @<!-- -->InternalApi.
|
||||
* {%jdoc !!core::lang.rule.RuleTargetSelector %}
|
||||
* Method `isRuleChain()` has been removed.
|
||||
* {%jdoc !!core::renderers.AbstractAccumulatingRenderer %}
|
||||
@ -224,13 +227,6 @@ package or made (package) private and are _not accessible_ anymore.
|
||||
* {%jdoc !!scala::ScalaLanguageModule %}
|
||||
* Method `dialectOf(LanguageVersion)` has been removed.
|
||||
|
||||
**Newly internal classes, interfaces and methods**
|
||||
|
||||
The following classes/methods are for now considered being internal API. Its usage should
|
||||
be avoided.
|
||||
|
||||
* {%jdoc !!core::lang.LanguageProcessor.AnalysisTask#withFiles(java.util.List) %}
|
||||
|
||||
**Removed classes and methods (previously deprecated)**
|
||||
|
||||
The following previously deprecated classes have been removed:
|
||||
|
@ -31,6 +31,7 @@ import net.sourceforge.pmd.internal.LogMessages;
|
||||
import net.sourceforge.pmd.internal.util.ClasspathClassLoader;
|
||||
import net.sourceforge.pmd.internal.util.FileCollectionUtil;
|
||||
import net.sourceforge.pmd.internal.util.IOUtil;
|
||||
import net.sourceforge.pmd.lang.InternalApiBridge;
|
||||
import net.sourceforge.pmd.lang.JvmLanguagePropertyBundle;
|
||||
import net.sourceforge.pmd.lang.Language;
|
||||
import net.sourceforge.pmd.lang.LanguageProcessor.AnalysisTask;
|
||||
@ -416,7 +417,7 @@ public final class PmdAnalysis implements AutoCloseable {
|
||||
// Note the analysis task is shared: all processors see
|
||||
// the same file list, which may contain files for other
|
||||
// languages.
|
||||
AnalysisTask analysisTask = new AnalysisTask(
|
||||
AnalysisTask analysisTask = InternalApiBridge.createAnalysisTask(
|
||||
rulesets,
|
||||
textFiles,
|
||||
listener,
|
||||
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.pmd.RuleSets;
|
||||
import net.sourceforge.pmd.annotation.InternalApi;
|
||||
import net.sourceforge.pmd.cache.internal.AnalysisCache;
|
||||
import net.sourceforge.pmd.lang.document.TextFile;
|
||||
import net.sourceforge.pmd.reporting.GlobalAnalysisListener;
|
||||
import net.sourceforge.pmd.util.log.PmdReporter;
|
||||
|
||||
/**
|
||||
* Internal API.
|
||||
*/
|
||||
@InternalApi
|
||||
public final class InternalApiBridge {
|
||||
private InternalApiBridge() {}
|
||||
|
||||
public static LanguageProcessor.AnalysisTask createAnalysisTask(RuleSets rulesets,
|
||||
List<TextFile> files,
|
||||
GlobalAnalysisListener listener,
|
||||
int threadCount,
|
||||
AnalysisCache analysisCache,
|
||||
PmdReporter messageReporter,
|
||||
LanguageProcessorRegistry lpRegistry) {
|
||||
return new LanguageProcessor.AnalysisTask(rulesets, files, listener, threadCount, analysisCache, messageReporter, lpRegistry);
|
||||
}
|
||||
|
||||
public static LanguageProcessor.AnalysisTask taskWithFiles(LanguageProcessor.AnalysisTask originalTask, List<TextFile> newFiles) {
|
||||
return originalTask.withFiles(newFiles);
|
||||
}
|
||||
}
|
@ -10,7 +10,6 @@ import java.util.List;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import net.sourceforge.pmd.RuleSets;
|
||||
import net.sourceforge.pmd.annotation.InternalApi;
|
||||
import net.sourceforge.pmd.cache.internal.AnalysisCache;
|
||||
import net.sourceforge.pmd.lang.document.TextFile;
|
||||
import net.sourceforge.pmd.reporting.GlobalAnalysisListener;
|
||||
@ -75,8 +74,7 @@ public interface LanguageProcessor extends AutoCloseable {
|
||||
*
|
||||
* @apiNote Internal API
|
||||
*/
|
||||
@InternalApi
|
||||
public AnalysisTask(RuleSets rulesets,
|
||||
AnalysisTask(RuleSets rulesets,
|
||||
List<TextFile> files,
|
||||
GlobalAnalysisListener listener,
|
||||
int threadCount,
|
||||
@ -125,8 +123,7 @@ public interface LanguageProcessor extends AutoCloseable {
|
||||
*
|
||||
* @apiNote Internal API
|
||||
*/
|
||||
@InternalApi
|
||||
public AnalysisTask withFiles(List<TextFile> newFiles) {
|
||||
AnalysisTask withFiles(List<TextFile> newFiles) {
|
||||
return new AnalysisTask(
|
||||
rulesets,
|
||||
newFiles,
|
||||
|
@ -9,6 +9,7 @@ import java.util.List;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import net.sourceforge.pmd.lang.InternalApiBridge;
|
||||
import net.sourceforge.pmd.lang.LanguageProcessor;
|
||||
import net.sourceforge.pmd.lang.LanguagePropertyBundle;
|
||||
import net.sourceforge.pmd.lang.LanguageVersion;
|
||||
@ -60,7 +61,7 @@ public abstract class BatchLanguageProcessor<P extends LanguagePropertyBundle> i
|
||||
// The given analysis task has all files to analyse, not only the ones for this language.
|
||||
List<TextFile> files = new ArrayList<>(task.getFiles());
|
||||
files.removeIf(it -> !it.getLanguageVersion().getLanguage().equals(getLanguage()));
|
||||
AnalysisTask newTask = task.withFiles(files);
|
||||
AnalysisTask newTask = InternalApiBridge.taskWithFiles(task, files);
|
||||
|
||||
task.getRulesets().initializeRules(task.getLpRegistry(), task.getMessageReporter());
|
||||
|
||||
|
@ -20,6 +20,7 @@ import net.sourceforge.pmd.RuleContext;
|
||||
import net.sourceforge.pmd.RuleSet;
|
||||
import net.sourceforge.pmd.RuleViolation;
|
||||
import net.sourceforge.pmd.lang.DummyLanguageModule;
|
||||
import net.sourceforge.pmd.lang.InternalApiBridge;
|
||||
import net.sourceforge.pmd.lang.LanguageProcessor;
|
||||
import net.sourceforge.pmd.lang.LanguageVersion;
|
||||
import net.sourceforge.pmd.lang.ast.Node;
|
||||
@ -47,7 +48,7 @@ abstract class AbstractPMDProcessorTest {
|
||||
}
|
||||
|
||||
private LanguageProcessor.AnalysisTask createTask(int threads) {
|
||||
return new LanguageProcessor.AnalysisTask(null, null, null, threads, null, null, null);
|
||||
return InternalApiBridge.createAnalysisTask(null, null, null, threads, null, null, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user