Package net.sourceforge.pmd.cache
Interface AnalysisCache
-
- All Known Implementing Classes:
AbstractAnalysisCache
,FileAnalysisCache
,NoopAnalysisCache
@Deprecated @InternalApi public interface AnalysisCache
Deprecated.This is internal API, will be hidden with 7.0.0An analysis cache for incremental analysis. Simultaneously manages the old version of the cache, and the new, most up-to-date violation cache.
-
-
Method Summary
All Methods Instance Methods Abstract 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 auxclassPathClassLoader)
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 file)
Deprecated.Returns a listener that will be used like inGlobalAnalysisListener.startFileAnalysis(TextFile)
.
-
-
-
Method Detail
-
persist
void persist() throws IOException
Deprecated.Persists the updated analysis results on whatever medium is used by the cache.- Throws:
IOException
-
isUpToDate
boolean isUpToDate(TextDocument document)
Deprecated.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.- Parameters:
document
- The file to check in the cache- Returns:
- True if the cache is a hit, false otherwise
-
getCachedViolations
List<RuleViolation> getCachedViolations(TextDocument sourceFile)
Deprecated.Retrieves cached violations for the given file. Make sure to callisUpToDate(TextDocument)
first.- Parameters:
sourceFile
- The file to check in the cache- Returns:
- The list of cached violations.
-
analysisFailed
void analysisFailed(TextDocument sourceFile)
Deprecated.Notifies the cache that analysis of the given file has failed and should not be cached.- Parameters:
sourceFile
- The file whose analysis failed
-
checkValidity
void checkValidity(RuleSets ruleSets, ClassLoader auxclassPathClassLoader)
Deprecated.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 ofisUpToDate(TextDocument)
.- Parameters:
ruleSets
- The rulesets configured for this analysis.auxclassPathClassLoader
- The class loader for auxclasspath configured for this analysis.
-
startFileAnalysis
FileAnalysisListener startFileAnalysis(TextDocument file)
Deprecated.Returns a listener that will be used like inGlobalAnalysisListener.startFileAnalysis(TextFile)
. This should record violations, and callanalysisFailed(TextDocument)
upon error.
-
-