diff options
16 files changed, 67 insertions, 57 deletions
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DependencyInfo.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DependencyInfo.java index 007faa15f62..e37b7a1fb35 100644 --- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DependencyInfo.java +++ b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/DependencyInfo.java @@ -39,7 +39,7 @@ import java.util.List; public final class DependencyInfo extends Composite { - private static DependencyInfo INSTANCE = new DependencyInfo(); + private static final DependencyInfo INSTANCE = new DependencyInfo(); private VerticalPanel panel; private Loading loading = new Loading(); diff --git a/sonar-batch/src/main/java/org/sonar/batch/MavenPluginExecutor.java b/sonar-batch/src/main/java/org/sonar/batch/MavenPluginExecutor.java index 89bc49f577e..760dd4db00b 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/MavenPluginExecutor.java +++ b/sonar-batch/src/main/java/org/sonar/batch/MavenPluginExecutor.java @@ -20,7 +20,6 @@ package org.sonar.batch; import org.sonar.api.BatchComponent; -import org.sonar.api.batch.bootstrap.ProjectDefinition; import org.sonar.api.batch.maven.MavenPluginHandler; import org.sonar.api.resources.Project; import org.sonar.batch.scan.filesystem.DefaultModuleFileSystem; diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/SensorsExecutor.java b/sonar-batch/src/main/java/org/sonar/batch/phases/SensorsExecutor.java index d08ae6cba8b..4ee128bed38 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/SensorsExecutor.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/SensorsExecutor.java @@ -26,7 +26,6 @@ import org.sonar.api.BatchComponent; import org.sonar.api.batch.BatchExtensionDictionnary; import org.sonar.api.batch.Sensor; import org.sonar.api.batch.SensorContext; -import org.sonar.api.batch.bootstrap.ProjectDefinition; import org.sonar.api.batch.maven.DependsUponMavenPlugin; import org.sonar.api.batch.maven.MavenPluginHandler; import org.sonar.api.resources.Project; diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ExclusionFileFilter.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ExclusionFileFilter.java index 1935205bad0..ee6470cbe57 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ExclusionFileFilter.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ExclusionFileFilter.java @@ -82,9 +82,13 @@ public class ExclusionFileFilter implements FileFilter, ResourceFilter, BatchCom } public boolean isIgnored(Resource resource) { - if (!ResourceUtils.isFile(resource)) { - return false; + if (ResourceUtils.isFile(resource)) { + return isIgnoredFileResource(resource); } + return false; + } + + private boolean isIgnoredFileResource(Resource resource) { WildcardPattern[] inclusionPatterns = (ResourceUtils.isUnitTestClass(resource) ? testInclusions : sourceInclusions); if (inclusionPatterns.length > 0) { boolean matchInclusion = false; diff --git a/sonar-core/src/main/java/org/sonar/api/database/configuration/DatabaseConfiguration.java b/sonar-core/src/main/java/org/sonar/api/database/configuration/DatabaseConfiguration.java index 671501d4890..a1e60187bf6 100644 --- a/sonar-core/src/main/java/org/sonar/api/database/configuration/DatabaseConfiguration.java +++ b/sonar-core/src/main/java/org/sonar/api/database/configuration/DatabaseConfiguration.java @@ -45,7 +45,7 @@ public class DatabaseConfiguration extends BaseConfiguration { load(); } - public void load() { + public final void load() { clear(); // Ugly workaround before the move to myBatis diff --git a/sonar-core/src/main/java/org/sonar/core/graph/BeanEdge.java b/sonar-core/src/main/java/org/sonar/core/graph/BeanEdge.java index f35e3b00ec1..7485c5c6603 100644 --- a/sonar-core/src/main/java/org/sonar/core/graph/BeanEdge.java +++ b/sonar-core/src/main/java/org/sonar/core/graph/BeanEdge.java @@ -24,7 +24,7 @@ import com.tinkerpop.blueprints.Edge; public abstract class BeanEdge extends BeanElement<Edge, BeanEdge> { - protected final <T extends BeanVertex> T getVertex(Class<T> vertexClass, Direction direction) throws IllegalArgumentException { + protected final <T extends BeanVertex> T getVertex(Class<T> vertexClass, Direction direction) { return beanGraph().wrap(element().getVertex(direction), vertexClass); } diff --git a/sonar-core/src/main/java/org/sonar/core/graph/SubGraph.java b/sonar-core/src/main/java/org/sonar/core/graph/SubGraph.java index 048a59f65c8..a2d7e5aa268 100644 --- a/sonar-core/src/main/java/org/sonar/core/graph/SubGraph.java +++ b/sonar-core/src/main/java/org/sonar/core/graph/SubGraph.java @@ -58,17 +58,15 @@ public class SubGraph { } private void browse(Vertex from, int cursor, List<Object> edgePath) { - if (from != null) { - if (cursor < edgePath.size()) { - Direction edgeDirection = (Direction) edgePath.get(cursor); - String edgeLabel = (String) edgePath.get(cursor + 1); - Iterable<Edge> edges = from.getEdges(edgeDirection, edgeLabel); - for (Edge edge : edges) { - edgesToCopy.add(edge); - Vertex tail = edge.getVertex(edgeDirection.opposite()); - copy(tail); - browse(tail, cursor + 2, edgePath); - } + if (from != null && cursor < edgePath.size()) { + Direction edgeDirection = (Direction) edgePath.get(cursor); + String edgeLabel = (String) edgePath.get(cursor + 1); + Iterable<Edge> edges = from.getEdges(edgeDirection, edgeLabel); + for (Edge edge : edges) { + edgesToCopy.add(edge); + Vertex tail = edge.getVertex(edgeDirection.opposite()); + copy(tail); + browse(tail, cursor + 2, edgePath); } } } diff --git a/sonar-core/src/main/java/org/sonar/core/graph/graphson/GraphsonTokens.java b/sonar-core/src/main/java/org/sonar/core/graph/graphson/GraphsonTokens.java index 41cdf51ad82..3a3e700b928 100644 --- a/sonar-core/src/main/java/org/sonar/core/graph/graphson/GraphsonTokens.java +++ b/sonar-core/src/main/java/org/sonar/core/graph/graphson/GraphsonTokens.java @@ -11,7 +11,7 @@ * Sonar is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * Lesser General License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with Sonar; if not, write to the Free Software @@ -24,26 +24,29 @@ package org.sonar.core.graph.graphson; * @author Stephen Mallette */ class GraphsonTokens { - public static final String VERTEX = "vertex"; - public static final String EDGE = "edge"; - public static final String _ID = "_id"; - public static final String _LABEL = "_label"; - public static final String _TYPE = "_type"; - public static final String _OUT_V = "_outV"; - public static final String _IN_V = "_inV"; - public static final String VALUE = "value"; - public static final String TYPE = "type"; - public static final String TYPE_LIST = "list"; - public static final String TYPE_STRING = "string"; - public static final String TYPE_DOUBLE = "double"; - public static final String TYPE_INTEGER = "integer"; - public static final String TYPE_FLOAT = "float"; - public static final String TYPE_MAP = "map"; - public static final String TYPE_BOOLEAN = "boolean"; - public static final String TYPE_LONG = "long"; - public static final String TYPE_UNKNOWN = "unknown"; + private GraphsonTokens() { + } - public static final String VERTICES = "vertices"; - public static final String EDGES = "edges"; - public static final String MODE = "mode"; + static final String VERTEX = "vertex"; + static final String EDGE = "edge"; + static final String _ID = "_id"; + static final String _LABEL = "_label"; + static final String _TYPE = "_type"; + static final String _OUT_V = "_outV"; + static final String _IN_V = "_inV"; + static final String VALUE = "value"; + static final String TYPE = "type"; + static final String TYPE_LIST = "list"; + static final String TYPE_STRING = "string"; + static final String TYPE_DOUBLE = "double"; + static final String TYPE_INTEGER = "integer"; + static final String TYPE_FLOAT = "float"; + static final String TYPE_MAP = "map"; + static final String TYPE_BOOLEAN = "boolean"; + static final String TYPE_LONG = "long"; + static final String TYPE_UNKNOWN = "unknown"; + + static final String VERTICES = "vertices"; + static final String EDGES = "edges"; + static final String MODE = "mode"; } diff --git a/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilterSql.java b/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilterSql.java index d8f2d8a4149..92f55a4019c 100644 --- a/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilterSql.java +++ b/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilterSql.java @@ -215,7 +215,7 @@ class MeasureFilterSql { to.append("') "); } - static abstract class RowProcessor { + abstract static class RowProcessor { abstract Function sortFieldFunction(); abstract Ordering sortFieldOrdering(boolean ascending); diff --git a/sonar-home/src/main/java/org/sonar/home/cache/FileCache.java b/sonar-home/src/main/java/org/sonar/home/cache/FileCache.java index 1fd9fef7ba3..cab5cd9d635 100644 --- a/sonar-home/src/main/java/org/sonar/home/cache/FileCache.java +++ b/sonar-home/src/main/java/org/sonar/home/cache/FileCache.java @@ -71,7 +71,7 @@ public class FileCache { return null; } - public static interface Downloader { + public interface Downloader { void download(String filename, File toFile) throws IOException; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/FileFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/FileFilter.java index 1041bcf5f40..28fc655e18d 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/FileFilter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/FileFilter.java @@ -21,6 +21,10 @@ package org.sonar.api.batch; import java.io.File; +/** + * @deprecated replaced by {@link org.sonar.api.scan.filesystem.FileFilter} in 3.5 + */ +@Deprecated public abstract class FileFilter implements java.io.FileFilter, org.sonar.api.scan.filesystem.FileFilter { public final boolean accept(File file, org.sonar.api.scan.filesystem.FileFilter.Context context) { return accept(file); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/SonarIndex.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/SonarIndex.java index 44cf1a1d901..b337c00489a 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/SonarIndex.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/SonarIndex.java @@ -97,7 +97,7 @@ public abstract class SonarIndex implements DirectedGraphAccessor<Resource, Depe * @throws org.sonar.api.resources.DuplicatedSourceException * if the source has already been set on this resource */ - public abstract void setSource(Resource reference, String source) throws DuplicatedSourceException; + public abstract void setSource(Resource reference, String source); /** * @return source code associated with a specified resource, <code>null</code> if not available diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java index 5b4b79bebe0..fbbfc823bcb 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java @@ -37,15 +37,16 @@ public final class CoreMetrics { // only static stuff } - public static final String DOMAIN_SIZE = "Size"; - public static final String DOMAIN_TESTS = "Tests"; - public static final String DOMAIN_INTEGRATION_TESTS = "Tests (Integration)"; - public static final String DOMAIN_OVERALL_TESTS = "Tests (Overall)"; - public static final String DOMAIN_COMPLEXITY = "Complexity"; - public static final String DOMAIN_DOCUMENTATION = "Documentation"; - public static final String DOMAIN_RULES = "Rules"; - public static final String DOMAIN_SCM = "SCM"; - public static final String DOMAIN_REVIEWS = "Reviews"; + // the following fields are not final to avoid compile-time constants used by plugins + public static String DOMAIN_SIZE = "Size"; + public static String DOMAIN_TESTS = "Tests"; + public static String DOMAIN_INTEGRATION_TESTS = "Tests (Integration)"; + public static String DOMAIN_OVERALL_TESTS = "Tests (Overall)"; + public static String DOMAIN_COMPLEXITY = "Complexity"; + public static String DOMAIN_DOCUMENTATION = "Documentation"; + public static String DOMAIN_RULES = "Rules"; + public static String DOMAIN_SCM = "SCM"; + public static String DOMAIN_REVIEWS = "Reviews"; /** * @deprecated since 2.5 See SONAR-2007 @@ -53,9 +54,9 @@ public final class CoreMetrics { @Deprecated public static final String DOMAIN_RULE_CATEGORIES = "Rule categories"; - public static final String DOMAIN_GENERAL = "General"; - public static final String DOMAIN_DUPLICATION = "Duplication"; - public static final String DOMAIN_DESIGN = "Design"; + public static String DOMAIN_GENERAL = "General"; + public static String DOMAIN_DUPLICATION = "Duplication"; + public static String DOMAIN_DESIGN = "Design"; public static final String LINES_KEY = "lines"; public static final Metric LINES = new Metric.Builder(LINES_KEY, "Lines", Metric.ValueType.INT) diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectFileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectFileSystem.java index b1a1af26980..897cc396d78 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectFileSystem.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectFileSystem.java @@ -30,6 +30,7 @@ import java.util.List; * @since 1.10 * @deprecated replaced by {@link org.sonar.api.scan.filesystem.ModuleFileSystem} in 3.5 */ +@Deprecated public interface ProjectFileSystem extends BatchComponent { /** * Source encoding. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileFilter.java index 42b98c1fc0d..ec4067d8de4 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileFilter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileFilter.java @@ -33,7 +33,7 @@ public interface FileFilter extends BatchExtension { SOURCE, TEST } - static interface Context { + interface Context { ModuleFileSystem fileSystem(); FileType fileType(); File sourceDir(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Semaphores.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Semaphores.java index d977250d8ec..ac47230abfc 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Semaphores.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Semaphores.java @@ -40,7 +40,8 @@ public interface Semaphores extends BatchComponent, ServerComponent { * outdated. * * @param name the key of the semaphore - * @param maxAgeInSeconds the max duration in seconds the semaphore will be considered unlocked if it was not updated. The value zero forces the semaphore to be acquired, whatever its status. + * @param maxAgeInSeconds the max duration in seconds the semaphore will be considered unlocked if + * it was not updated. The value zero forces the semaphore to be acquired, whatever its status. * @param updatePeriodInSeconds the period in seconds the semaphore will be updated. * @return the semaphore, whatever its status (locked or unlocked). Can't be null. */ |