Skip to content

Commit

Permalink
SLCORE-1027 Do not wipe cache for unrelated files
Browse files Browse the repository at this point in the history
  • Loading branch information
nquinquenel committed Nov 5, 2024
1 parent d23e2e0 commit 70eab79
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@

import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.inject.Named;
import javax.inject.Singleton;
import org.sonarsource.sonarlint.core.rpc.protocol.client.hotspot.RaisedHotspotDto;
Expand Down Expand Up @@ -71,8 +70,8 @@ public void resetFindingsCache(String scopeId, Set<URI> files) {
}

private static <F extends RaisedFindingDto> void resetCacheForFindings(String scopeId, Set<URI> files, Map<String, Map<URI, List<F>>> cache) {
Map<URI, List<F>> blankCache = files.stream().collect(Collectors.toMap(Function.identity(), e -> new ArrayList<>()));
cache.compute(scopeId, (file, issues) -> blankCache);
var scopeCache = cache.computeIfAbsent(scopeId, c -> new HashMap<>());
files.forEach(file -> scopeCache.put(file, new ArrayList<>()));
}

public Optional<RaisedIssueDto> getRaisedIssueWithScopeAndId(String scopeId, UUID issueId) {
Expand Down

0 comments on commit 70eab79

Please sign in to comment.