Package net.sourceforge.pmd.cache
Class NoopAnalysisCache
- java.lang.Object
-
- net.sourceforge.pmd.cache.NoopAnalysisCache
-
- All Implemented Interfaces:
AnalysisCache
,ThreadSafeReportListener
@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(File 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(File sourceFile)
Deprecated.Retrieves cached violations for the given file.boolean
isUpToDate(File sourceFile)
Deprecated.Checks if a given file is up to date in the cache and can be skipped from analysis.void
metricAdded(Metric metric)
Deprecated.A new metric point has been reported.void
persist()
Deprecated.Persists the updated analysis results on whatever medium is used by the cache.void
ruleViolationAdded(RuleViolation ruleViolation)
Deprecated.A new violation has been found.
-
-
-
Method Detail
-
ruleViolationAdded
public void ruleViolationAdded(RuleViolation ruleViolation)
Deprecated.Description copied from interface:ThreadSafeReportListener
A new violation has been found.- Specified by:
ruleViolationAdded
in interfaceThreadSafeReportListener
- Parameters:
ruleViolation
- the found violation.
-
metricAdded
public void metricAdded(Metric metric)
Deprecated.Description copied from interface:ThreadSafeReportListener
A new metric point has been reported.- Specified by:
metricAdded
in interfaceThreadSafeReportListener
- Parameters:
metric
- the metric
-
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(File sourceFile)
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 allowsThreadSafeReportListener.ruleViolationAdded(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:
sourceFile
- The file to check in the cache- Returns:
- True if the cache is a hit, false otherwise
-
analysisFailed
public void analysisFailed(File 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(File)
.- 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(File sourceFile)
Deprecated.Description copied from interface:AnalysisCache
Retrieves cached violations for the given file. Make sure to callAnalysisCache.isUpToDate(File)
first.- Specified by:
getCachedViolations
in interfaceAnalysisCache
- Parameters:
sourceFile
- The file to check in the cache- Returns:
- The list of cached violations.
-
-