From e0439d50c62daa7920839a8f8655c748fb664d6c Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Tue, 22 Feb 2011 21:29:33 +0300 Subject: [PATCH] Make DefaultIndex non-final and Module.getComponent public --- .../src/main/java/org/sonar/batch/Module.java | 4 ++-- .../java/org/sonar/batch/index/DefaultIndex.java | 14 +++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/sonar-batch/src/main/java/org/sonar/batch/Module.java b/sonar-batch/src/main/java/org/sonar/batch/Module.java index 73f4b2b0ed9..f4ee3279c2d 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/Module.java +++ b/sonar-batch/src/main/java/org/sonar/batch/Module.java @@ -115,11 +115,11 @@ public abstract class Module { container.addAdapter(componentAdapter); } - protected final T getComponent(Class componentType) { + public final T getComponent(Class componentType) { return container.getComponent(componentType); } - protected final List getComponents(Class componentType) { + public final List getComponents(Class componentType) { return container.getComponents(componentType); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java index 09529e5c1b3..abafcdb150e 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java @@ -19,6 +19,8 @@ */ package org.sonar.batch.index; +import java.util.*; + import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; @@ -41,9 +43,7 @@ import org.sonar.batch.ProjectTree; import org.sonar.batch.ResourceFilters; import org.sonar.batch.ViolationFilters; -import java.util.*; - -public final class DefaultIndex extends SonarIndex { +public class DefaultIndex extends SonarIndex { private static final Logger LOG = LoggerFactory.getLogger(DefaultIndex.class); @@ -133,7 +133,6 @@ public final class DefaultIndex extends SonarIndex { lock.unlock(); } - public Measure getMeasure(Resource resource, Metric metric) { Bucket bucket = buckets.get(resource); if (bucket != null) { @@ -294,10 +293,10 @@ public final class DefaultIndex extends SonarIndex { Resource resource = violation.getResource(); if (resource == null) { violation.setResource(currentProject); - } else if (!Scopes.isHigherThanOrEquals(resource, Scopes.FILE)){ + } else if (!Scopes.isHigherThanOrEquals(resource, Scopes.FILE)) { throw new IllegalArgumentException("Violations are only supported on files, directories and project"); } - + Bucket bucket = checkIndexed(resource); if (bucket != null && !bucket.isExcluded()) { boolean isIgnored = !force && violationFilters != null && violationFilters.isIgnored(violation); @@ -371,7 +370,6 @@ public final class DefaultIndex extends SonarIndex { } } - /** * Does nothing if the resource is already registered. */ @@ -411,7 +409,6 @@ public final class DefaultIndex extends SonarIndex { return getChildren(resource, false); } - public List getChildren(Resource resource, boolean acceptExcluded) { List children = Lists.newLinkedList(); Bucket bucket = getBucket(resource, acceptExcluded); @@ -507,7 +504,6 @@ public final class DefaultIndex extends SonarIndex { return bucket; } - public boolean isExcluded(Resource reference) { Bucket bucket = getBucket(reference, true); return bucket != null && bucket.isExcluded(); -- 2.39.5