[core] Fix the cache

- The cache listener was broken, and violations never actually made it to the cache
This commit is contained in:
Juan Martín Sotuyo Dodero committed 2023-01-25 19:19:10 -03:00
1 parent 596cc2694d
commit 4f947b46e0
1 file changed
+2 -9
@@ -211,19 +211,12 @@ public abstract class AbstractAnalysisCache implements AnalysisCache {
@Override
public FileAnalysisListener startFileAnalysis(TextDocument file) {
String fileName = file.getPathId();
AnalysisResult analysisResult = updatedResultsCache.get(fileName);
if (analysisResult == null) {
analysisResult = new AnalysisResult(file.getCheckSum());
}
final AnalysisResult nonNullAnalysisResult = analysisResult;
final String fileName = file.getPathId();
return new FileAnalysisListener() {
@Override
public void onRuleViolation(RuleViolation violation) {
synchronized (nonNullAnalysisResult) {
nonNullAnalysisResult.addViolation(violation);
}
updatedResultsCache.get(fileName).addViolation(violation);
}
@Override