public abstract class AbstractAnalysisCache extends Object implements AnalysisCache
Modifier and Type | Field and Description |
---|---|
protected long |
classpathChecksum |
protected ConcurrentMap<String,AnalysisResult> |
fileResultsCache |
protected static Logger |
LOG |
protected String |
pmdVersion |
protected CachedRuleMapper |
ruleMapper |
protected long |
rulesetChecksum |
protected ConcurrentMap<String,AnalysisResult> |
updatedResultsCache |
Constructor and Description |
---|
AbstractAnalysisCache()
Creates a new empty cache
|
Modifier and Type | Method and Description |
---|---|
void |
analysisFailed(File sourceFile)
Notifies the cache that analysis of the given file has failed and should not be cached
|
void |
checkValidity(RuleSets ruleSets,
ClassLoader classLoader)
Checks if the cache is valid for the configured rulesets and class loader.
|
List<RuleViolation> |
getCachedViolations(File sourceFile)
Retrieves cached violations for the given file.
|
boolean |
isUpToDate(File sourceFile)
Check if a given file is up to date in the cache and can be skipped from analysis
|
void |
metricAdded(Metric metric)
A new metric point has been reported.
|
void |
ruleViolationAdded(RuleViolation ruleViolation)
A new violation has been found.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
persist
protected static final Logger LOG
protected final String pmdVersion
protected final ConcurrentMap<String,AnalysisResult> fileResultsCache
protected final ConcurrentMap<String,AnalysisResult> updatedResultsCache
protected long rulesetChecksum
protected long classpathChecksum
protected final CachedRuleMapper ruleMapper
public boolean isUpToDate(File sourceFile)
AnalysisCache
isUpToDate
in interface AnalysisCache
sourceFile
- The file to check in the cachepublic List<RuleViolation> getCachedViolations(File sourceFile)
AnalysisCache
AnalysisCache.isUpToDate(File)
first.getCachedViolations
in interface AnalysisCache
sourceFile
- The file to check in the cachepublic void analysisFailed(File sourceFile)
AnalysisCache
analysisFailed
in interface AnalysisCache
sourceFile
- The file whose analysis failedpublic void checkValidity(RuleSets ruleSets, ClassLoader classLoader)
AnalysisCache
checkValidity
in interface AnalysisCache
ruleSets
- The rulesets configured for this analysis.classLoader
- The class loader configured for this analysis.public void ruleViolationAdded(RuleViolation ruleViolation)
ThreadSafeReportListener
ruleViolationAdded
in interface ReportListener
ruleViolationAdded
in interface ThreadSafeReportListener
ruleViolation
- the found violation.public void metricAdded(Metric metric)
ThreadSafeReportListener
metricAdded
in interface ReportListener
metricAdded
in interface ThreadSafeReportListener
metric
- the metricCopyright © 2002–2017 PMD. All rights reserved.