Package net.sourceforge.pmd.cache
Class AbstractAnalysisCache
- java.lang.Object
-
- net.sourceforge.pmd.cache.AbstractAnalysisCache
-
- All Implemented Interfaces:
AnalysisCache,ThreadSafeReportListener
- Direct Known Subclasses:
FileAnalysisCache
@Deprecated @InternalApi public abstract class AbstractAnalysisCache extends java.lang.Object implements AnalysisCache
Deprecated.This is internal API, will be hidden with 7.0.0Abstract implementation of the analysis cache. Handles all operations, except for persistence.
-
-
Field Summary
Fields Modifier and Type Field Description protected longauxClassPathChecksumDeprecated.protected longexecutionClassPathChecksumDeprecated.protected java.util.concurrent.ConcurrentMap<java.lang.String,AnalysisResult>fileResultsCacheDeprecated.protected static java.util.logging.LoggerLOGDeprecated.protected java.lang.StringpmdVersionDeprecated.protected CachedRuleMapperruleMapperDeprecated.protected longrulesetChecksumDeprecated.protected java.util.concurrent.ConcurrentMap<java.lang.String,AnalysisResult>updatedResultsCacheDeprecated.
-
Constructor Summary
Constructors Constructor Description AbstractAnalysisCache()Deprecated.Creates a new empty cache
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidanalysisFailed(java.io.File sourceFile)Deprecated.Notifies the cache that analysis of the given file has failed and should not be cached.protected abstract booleancacheExists()Deprecated.Returns true if the cache exists.voidcheckValidity(RuleSets ruleSets, java.lang.ClassLoader auxclassPathClassLoader)Deprecated.Checks if the cache is valid for the configured rulesets and class loader.java.util.List<RuleViolation>getCachedViolations(java.io.File sourceFile)Deprecated.Retrieves cached violations for the given file.booleanisUpToDate(java.io.File sourceFile)Deprecated.Checks if a given file is up to date in the cache and can be skipped from analysis.voidmetricAdded(Metric metric)Deprecated.A new metric point has been reported.voidruleViolationAdded(RuleViolation ruleViolation)Deprecated.A new violation has been found.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sourceforge.pmd.cache.AnalysisCache
persist
-
-
-
-
Field Detail
-
LOG
protected static final java.util.logging.Logger LOG
Deprecated.
-
pmdVersion
protected final java.lang.String pmdVersion
Deprecated.
-
fileResultsCache
protected final java.util.concurrent.ConcurrentMap<java.lang.String,AnalysisResult> fileResultsCache
Deprecated.
-
updatedResultsCache
protected final java.util.concurrent.ConcurrentMap<java.lang.String,AnalysisResult> updatedResultsCache
Deprecated.
-
ruleMapper
protected final CachedRuleMapper ruleMapper
Deprecated.
-
rulesetChecksum
protected long rulesetChecksum
Deprecated.
-
auxClassPathChecksum
protected long auxClassPathChecksum
Deprecated.
-
executionClassPathChecksum
protected long executionClassPathChecksum
Deprecated.
-
-
Method Detail
-
isUpToDate
public boolean isUpToDate(java.io.File sourceFile)
Deprecated.Description copied from interface:AnalysisCacheChecks 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:
isUpToDatein interfaceAnalysisCache- Parameters:
sourceFile- The file to check in the cache- Returns:
- True if the cache is a hit, false otherwise
-
getCachedViolations
public java.util.List<RuleViolation> getCachedViolations(java.io.File sourceFile)
Deprecated.Description copied from interface:AnalysisCacheRetrieves cached violations for the given file. Make sure to callAnalysisCache.isUpToDate(File)first.- Specified by:
getCachedViolationsin interfaceAnalysisCache- Parameters:
sourceFile- The file to check in the cache- Returns:
- The list of cached violations.
-
analysisFailed
public void analysisFailed(java.io.File sourceFile)
Deprecated.Description copied from interface:AnalysisCacheNotifies the cache that analysis of the given file has failed and should not be cached.- Specified by:
analysisFailedin interfaceAnalysisCache- Parameters:
sourceFile- The file whose analysis failed
-
cacheExists
protected abstract boolean cacheExists()
Deprecated.Returns true if the cache exists. If so, normal cache validity checks will be performed. Otherwise, the cache is necessarily invalid (e.g. on a first run).
-
checkValidity
public void checkValidity(RuleSets ruleSets, java.lang.ClassLoader auxclassPathClassLoader)
Deprecated.Description copied from interface:AnalysisCacheChecks 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:
checkValidityin interfaceAnalysisCache- Parameters:
ruleSets- The rulesets configured for this analysis.auxclassPathClassLoader- The class loader for auxclasspath configured for this analysis.
-
ruleViolationAdded
public void ruleViolationAdded(RuleViolation ruleViolation)
Deprecated.Description copied from interface:ThreadSafeReportListenerA new violation has been found.- Specified by:
ruleViolationAddedin interfaceThreadSafeReportListener- Parameters:
ruleViolation- the found violation.
-
metricAdded
public void metricAdded(Metric metric)
Deprecated.Description copied from interface:ThreadSafeReportListenerA new metric point has been reported.- Specified by:
metricAddedin interfaceThreadSafeReportListener- Parameters:
metric- the metric
-
-