Package net.sourceforge.pmd.cache
Class NoopAnalysisCache
- java.lang.Object
-
- net.sourceforge.pmd.cache.NoopAnalysisCache
-
- All Implemented Interfaces:
AnalysisCache
@Deprecated @InternalApi public class NoopAnalysisCache extends Object implements AnalysisCache
Deprecated.This is internal API, will be hidden with 7.0.0A NOOP analysis cache. Easier / safer than null-checking.
-
-
Constructor Summary
Constructors Constructor Description NoopAnalysisCache()
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
analysisFailed(TextDocument sourceFile)
Deprecated.Notifies the cache that analysis of the given file has failed and should not be cached.void
checkValidity(RuleSets ruleSets, ClassLoader classLoader)
Deprecated.Checks if the cache is valid for the configured rulesets and class loader.List<RuleViolation>
getCachedViolations(TextDocument sourceFile)
Deprecated.Retrieves cached violations for the given file.boolean
isUpToDate(TextDocument document)
Deprecated.Checks if a given file is up to date in the cache and can be skipped from analysis.void
persist()
Deprecated.Persists the updated analysis results on whatever medium is used by the cache.FileAnalysisListener
startFileAnalysis(TextDocument filename)
Deprecated.Returns a listener that will be used like inGlobalAnalysisListener.startFileAnalysis(TextFile)
.
-
-
-
Method Detail
-
persist
public void persist()
Deprecated.Description copied from interface:AnalysisCache
Persists the updated analysis results on whatever medium is used by the cache.- Specified by:
persist
in interfaceAnalysisCache
-
isUpToDate
public boolean isUpToDate(TextDocument document)
Deprecated.Description copied from interface:AnalysisCache
Checks if a given file is up to date in the cache and can be skipped from analysis. Regardless of the return value of this method, each call adds the parameter to the updated cache, which allowsFileAnalysisListener.onRuleViolation(RuleViolation)
to add a rule violation to the file. TODO is this really best behaviour? This side-effects seems counter-intuitive.- Specified by:
isUpToDate
in interfaceAnalysisCache
- Parameters:
document
- The file to check in the cache- Returns:
- True if the cache is a hit, false otherwise
-
analysisFailed
public void analysisFailed(TextDocument sourceFile)
Deprecated.Description copied from interface:AnalysisCache
Notifies the cache that analysis of the given file has failed and should not be cached.- Specified by:
analysisFailed
in interfaceAnalysisCache
- Parameters:
sourceFile
- The file whose analysis failed
-
checkValidity
public void checkValidity(RuleSets ruleSets, ClassLoader classLoader)
Deprecated.Description copied from interface:AnalysisCache
Checks if the cache is valid for the configured rulesets and class loader. If the provided rulesets and classpath don't match those of the cache, the cache is invalidated. This needs to be called before analysis, as it conditions the good behaviour ofAnalysisCache.isUpToDate(TextDocument)
.- Specified by:
checkValidity
in interfaceAnalysisCache
- Parameters:
ruleSets
- The rulesets configured for this analysis.classLoader
- The class loader for auxclasspath configured for this analysis.
-
getCachedViolations
public List<RuleViolation> getCachedViolations(TextDocument sourceFile)
Deprecated.Description copied from interface:AnalysisCache
Retrieves cached violations for the given file. Make sure to callAnalysisCache.isUpToDate(TextDocument)
first.- Specified by:
getCachedViolations
in interfaceAnalysisCache
- Parameters:
sourceFile
- The file to check in the cache- Returns:
- The list of cached violations.
-
startFileAnalysis
public FileAnalysisListener startFileAnalysis(TextDocument filename)
Deprecated.Description copied from interface:AnalysisCache
Returns a listener that will be used like inGlobalAnalysisListener.startFileAnalysis(TextFile)
. This should record violations, and callAnalysisCache.analysisFailed(TextDocument)
upon error.- Specified by:
startFileAnalysis
in interfaceAnalysisCache
-
-