Skip to content

Commit

Permalink
change to static map
Browse files Browse the repository at this point in the history
  • Loading branch information
jmecosta committed Apr 9, 2016
1 parent 3ce3529 commit 75bd9b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
package org.sonar.plugins.cxx.coverage;

import com.google.common.collect.Maps;
import java.util.Map;
import java.util.WeakHashMap;
import org.sonar.api.BatchExtension;
Expand All @@ -27,24 +28,24 @@

public class CxxCoverageCache implements BatchExtension {

private final WeakHashMap<String, Map<String, CoverageMeasuresBuilder>> cacheUnit = new WeakHashMap<>();
private final WeakHashMap<String, Map<String, CoverageMeasuresBuilder>> cacheIntegration = new WeakHashMap<>();
private final WeakHashMap<String, Map<String, CoverageMeasuresBuilder>> cacheOverall = new WeakHashMap<>();
private final static Map<String, Map<String, CoverageMeasuresBuilder>> cacheUnit = Maps.newHashMap();
private final static Map<String, Map<String, CoverageMeasuresBuilder>> cacheIntegration = Maps.newHashMap();
private final static Map<String, Map<String, CoverageMeasuresBuilder>> cacheOverall = Maps.newHashMap();
private final long datetime;

public CxxCoverageCache(long datetime, Settings setting) {
this.datetime = datetime;
}

public WeakHashMap<String, Map<String, CoverageMeasuresBuilder>> unitCoverageCache() {
public Map<String, Map<String, CoverageMeasuresBuilder>> unitCoverageCache() {
return cacheUnit;
}

public WeakHashMap<String, Map<String, CoverageMeasuresBuilder>> integrationCoverageCache() {
public Map<String, Map<String, CoverageMeasuresBuilder>> integrationCoverageCache() {
return cacheIntegration;
}

public WeakHashMap<String, Map<String, CoverageMeasuresBuilder>> overallCoverageCache() {
public Map<String, Map<String, CoverageMeasuresBuilder>> overallCoverageCache() {
return cacheOverall;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void analyse(Project project, SensorContext context) {
}
}

private Map<String, CoverageMeasuresBuilder> processReports(final Project project, final SensorContext context, List<File> reports, WeakHashMap<String, Map<String, CoverageMeasuresBuilder>> cacheCov) {
private Map<String, CoverageMeasuresBuilder> processReports(final Project project, final SensorContext context, List<File> reports, Map<String, Map<String, CoverageMeasuresBuilder>> cacheCov) {
Map<String, CoverageMeasuresBuilder> measuresTotal = new HashMap<>();
Map<String, CoverageMeasuresBuilder> measuresForReport = new HashMap<>();

Expand Down

0 comments on commit 75bd9b8

Please sign in to comment.