aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2012-02-17 12:48:07 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2012-02-17 13:46:50 +0400
commit0aa289a5926819abf28961be3d2f1e772648e9fb (patch)
tree2b4e7df2d9c0c383ca532b57f59db3be5a991740
parentaa342c58f14c8bc402f69143e9451aaad878e6c3 (diff)
downloadsonarqube-0aa289a5926819abf28961be3d2f1e772648e9fb.tar.gz
sonarqube-0aa289a5926819abf28961be3d2f1e772648e9fb.zip
Fix some quality flaws
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyAnalyser.java10
-rw-r--r--plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsCategory.java2
-rw-r--r--plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JacocoAntInitializer.java2
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/visitor/PublicApiVisitor.java13
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/visitor/SuppressWarningsAnnotationUtils.java6
-rw-r--r--plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/data/UnitTestResult.java8
-rw-r--r--sonar-channel/src/main/java/org/sonar/channel/CodeReaderConfiguration.java10
-rw-r--r--sonar-colorizer/src/main/java/org/sonar/colorizer/JavaConstantTokenizer.java2
-rw-r--r--sonar-colorizer/src/main/java/org/sonar/colorizer/KeywordsTokenizer.java6
-rw-r--r--sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java5
-rw-r--r--sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java2
-rw-r--r--sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java2
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/cpd/MatchAlgorithm.java3
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Search.java10
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java57
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java3
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java2
-rw-r--r--sonar-squid/src/main/java/org/sonar/squid/text/Line.java3
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java2
22 files changed, 74 insertions, 83 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyAnalyser.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyAnalyser.java
index 995afdc29bf..4277f9d7bd0 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyAnalyser.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyAnalyser.java
@@ -23,11 +23,11 @@ import java.util.List;
public class TendencyAnalyser {
- public final static Integer TENDENCY_BIG_UP = 2;
- public final static Integer TENDENCY_UP = 1;
- public final static Integer TENDENCY_NEUTRAL = 0;
- public final static Integer TENDENCY_DOWN = -1;
- public final static Integer TENDENCY_BIG_DOWN = -2;
+ public static final Integer TENDENCY_BIG_UP = 2;
+ public static final Integer TENDENCY_UP = 1;
+ public static final Integer TENDENCY_NEUTRAL = 0;
+ public static final Integer TENDENCY_DOWN = -1;
+ public static final Integer TENDENCY_BIG_DOWN = -2;
public Integer analyseLevel(List<Double> values) {
TendencyAnalyser.SlopeData slopeData = analyse(values);
diff --git a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsCategory.java b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsCategory.java
index bda1bd7cd6e..dcdcc76a3f4 100644
--- a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsCategory.java
+++ b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsCategory.java
@@ -23,7 +23,7 @@ import java.util.HashMap;
import java.util.Map;
public final class FindbugsCategory {
- private final static Map<String, String> FINDBUGS_TO_SONAR = new HashMap<String, String>();
+ private static final Map<String, String> FINDBUGS_TO_SONAR = new HashMap<String, String>();
static {
FINDBUGS_TO_SONAR.put("BAD_PRACTICE", "Bad practice");
diff --git a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JacocoAntInitializer.java b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JacocoAntInitializer.java
index 2c3dc35afaf..fcbb63f294c 100644
--- a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JacocoAntInitializer.java
+++ b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JacocoAntInitializer.java
@@ -106,7 +106,7 @@ public class JacocoAntInitializer extends Initializer implements CoverageExtensi
}
- private static abstract class TaskEnhancer {
+ private abstract static class TaskEnhancer {
/**
* @param task Task instance to enhance
* @return <code>true</code> if this enhancer is capable of enhancing the requested task
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/visitor/PublicApiVisitor.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/visitor/PublicApiVisitor.java
index 94d96dd4c10..bf2a3c5bed0 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/visitor/PublicApiVisitor.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/visitor/PublicApiVisitor.java
@@ -19,21 +19,16 @@
*/
package org.sonar.java.ast.visitor;
-import java.util.Arrays;
-import java.util.List;
-
+import com.puppycrawl.tools.checkstyle.api.*;
import org.sonar.squid.api.SourceCode;
import org.sonar.squid.measures.Metric;
-import com.puppycrawl.tools.checkstyle.api.AnnotationUtility;
-import com.puppycrawl.tools.checkstyle.api.DetailAST;
-import com.puppycrawl.tools.checkstyle.api.FileContents;
-import com.puppycrawl.tools.checkstyle.api.Scope;
-import com.puppycrawl.tools.checkstyle.api.TokenTypes;
+import java.util.Arrays;
+import java.util.List;
public class PublicApiVisitor extends JavaAstVisitor {
- final static String OVERRIDE_ANNOTATION_KEYWORD = "Override";
+ static final String OVERRIDE_ANNOTATION_KEYWORD = "Override";
public static final List<Integer> TOKENS = Arrays.asList(TokenTypes.CLASS_DEF, TokenTypes.INTERFACE_DEF, TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF, TokenTypes.ANNOTATION_DEF, TokenTypes.ANNOTATION_FIELD_DEF, TokenTypes.VARIABLE_DEF);
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/visitor/SuppressWarningsAnnotationUtils.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/visitor/SuppressWarningsAnnotationUtils.java
index c0413ddf322..fb2c20174de 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/visitor/SuppressWarningsAnnotationUtils.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/visitor/SuppressWarningsAnnotationUtils.java
@@ -29,9 +29,9 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes;
*/
public final class SuppressWarningsAnnotationUtils {
- private final static String SUPPRESS_WARNINGS_ANNOTATION_NAME = "SuppressWarnings";
- private final static String SUPPRESS_WARNINGS_ANNOTATION_FQ_NAME = "java.lang." + SUPPRESS_WARNINGS_ANNOTATION_NAME;
- private final static String VALUE = "\"all\"";
+ private static final String SUPPRESS_WARNINGS_ANNOTATION_NAME = "SuppressWarnings";
+ private static final String SUPPRESS_WARNINGS_ANNOTATION_FQ_NAME = "java.lang." + SUPPRESS_WARNINGS_ANNOTATION_NAME;
+ private static final String VALUE = "\"all\"";
public static boolean isSuppressAllWarnings(DetailAST ast) {
DetailAST suppressWarningsAnnotation = getSuppressWarningsAnnotation(ast);
diff --git a/plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/data/UnitTestResult.java b/plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/data/UnitTestResult.java
index 63cbe164a2c..17b8f8a26f2 100644
--- a/plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/data/UnitTestResult.java
+++ b/plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/data/UnitTestResult.java
@@ -22,10 +22,10 @@ package org.sonar.plugins.surefire.data;
import org.apache.commons.lang.StringEscapeUtils;
public final class UnitTestResult {
- public final static String STATUS_OK = "ok";
- public final static String STATUS_ERROR = "error";
- public final static String STATUS_FAILURE = "failure";
- public final static String STATUS_SKIPPED = "skipped";
+ public static final String STATUS_OK = "ok";
+ public static final String STATUS_ERROR = "error";
+ public static final String STATUS_FAILURE = "failure";
+ public static final String STATUS_SKIPPED = "skipped";
private String name, status, stackTrace, message;
private long durationMilliseconds = 0L;
diff --git a/sonar-channel/src/main/java/org/sonar/channel/CodeReaderConfiguration.java b/sonar-channel/src/main/java/org/sonar/channel/CodeReaderConfiguration.java
index 55712718a0b..b0b88dc4432 100644
--- a/sonar-channel/src/main/java/org/sonar/channel/CodeReaderConfiguration.java
+++ b/sonar-channel/src/main/java/org/sonar/channel/CodeReaderConfiguration.java
@@ -27,14 +27,14 @@ import java.util.List;
* Configuration parameters used by a CodeReader to handle some specificities.
*/
public class CodeReaderConfiguration {
-
+
/**
* @deprecated in 2.12, do not use anymore.
*/
@Deprecated
- public final static int DEFAULT_BUFFER_CAPACITY = 8000;
+ public static final int DEFAULT_BUFFER_CAPACITY = 8000;
- public final static int DEFAULT_TAB_WIDTH = 1;
+ public static final int DEFAULT_TAB_WIDTH = 1;
private int tabWidth = DEFAULT_TAB_WIDTH;
@@ -57,7 +57,7 @@ public class CodeReaderConfiguration {
@Deprecated
public void setBufferCapacity(int bufferCapacity) {
}
-
+
/**
* @return the tabWidth
*/
@@ -91,7 +91,7 @@ public class CodeReaderConfiguration {
/**
* Adds a code reader filter
- *
+ *
* @param codeReaderFilter
* the codeReaderFilter to add
*/
diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaConstantTokenizer.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaConstantTokenizer.java
index a7eee6b7e0f..b16fd4de4db 100644
--- a/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaConstantTokenizer.java
+++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaConstantTokenizer.java
@@ -29,7 +29,7 @@ public class JavaConstantTokenizer extends Tokenizer {
private final String tagBefore;
private final String tagAfter;
- private final static int DOT = '.';
+ private static final int DOT = '.';
public JavaConstantTokenizer(String tagBefore, String tagAfter) {
this.tagBefore = tagBefore;
diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/KeywordsTokenizer.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/KeywordsTokenizer.java
index d576a505873..e2ed24ecd4c 100644
--- a/sonar-colorizer/src/main/java/org/sonar/colorizer/KeywordsTokenizer.java
+++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/KeywordsTokenizer.java
@@ -19,14 +19,14 @@
*/
package org.sonar.colorizer;
+import org.sonar.channel.CodeReader;
+
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.sonar.channel.CodeReader;
-
/**
* Detect case-sensitive keywords
*/
@@ -37,7 +37,7 @@ public class KeywordsTokenizer extends NotThreadSafeTokenizer {
private boolean caseInsensitive = false;
private Matcher matcher;
private final StringBuilder tmpBuilder = new StringBuilder();
- private final static String DEFAULT_REGEX = "[a-zA-Z_][a-zA-Z0-9_]*+";
+ private static final String DEFAULT_REGEX = "[a-zA-Z_][a-zA-Z0-9_]*+";
private Set<String> keywords = new HashSet<String>();
diff --git a/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java b/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java
index 9c79cdab541..8598d2a68e5 100644
--- a/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java
+++ b/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java
@@ -23,6 +23,7 @@ import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import javax.persistence.*;
+
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -32,12 +33,12 @@ import java.sql.Statement;
@Table(name = SchemaMigration.TABLE_NAME, uniqueConstraints = {@UniqueConstraint(columnNames = {"version"})})
public class SchemaMigration {
- public final static int VERSION_UNKNOWN = -1;
+ public static final int VERSION_UNKNOWN = -1;
public static final int LAST_VERSION = 263;
public static final int VERSION_2_13 = 241;
- public final static String TABLE_NAME = "schema_migrations";
+ public static final String TABLE_NAME = "schema_migrations";
@Id
@Column(name = "version", updatable = true)
diff --git a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java
index 794851b04d3..e0fa7964913 100644
--- a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java
+++ b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java
@@ -37,7 +37,7 @@ public class SourceCode {
public static final String EOL = System.getProperty("line.separator", "\n");
- public static abstract class CodeLoader {
+ public abstract static class CodeLoader {
private SoftReference<List<String>> code;
public List<String> getCode() {
diff --git a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java
index a615af964d3..868b8e2eeea 100644
--- a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java
+++ b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java
@@ -33,7 +33,7 @@ import java.util.Map;
*/
public class TokenEntry implements Comparable<TokenEntry> {
- private final static Map<String, Integer> TOKENS = new HashMap<String, Integer>();
+ private static final Map<String, Integer> TOKENS = new HashMap<String, Integer>();
private static int tokenCount = 0;
/**
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/cpd/MatchAlgorithm.java b/sonar-duplications/src/main/java/org/sonar/duplications/cpd/MatchAlgorithm.java
index d9b5827a4bb..0b25bbcfca5 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/cpd/MatchAlgorithm.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/cpd/MatchAlgorithm.java
@@ -29,7 +29,7 @@ import java.util.*;
public class MatchAlgorithm {
- private final static int MOD = 37;
+ private static final int MOD = 37;
private int lastHash;
private int lastMod = 1;
@@ -110,7 +110,6 @@ public class MatchAlgorithm {
cpdListener.phaseUpdate(CPDListener.DONE);
}
- @SuppressWarnings("PMD.JumbledIncrementer")
private Map<TokenEntry, Object> hash() {
Map<TokenEntry, Object> markGroups = new HashMap<TokenEntry, Object>(tokens.size());
for (int i = code.size() - 1; i >= 0; i--) {
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Search.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Search.java
index 73fd6d596ca..650f9864dd5 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Search.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Search.java
@@ -19,10 +19,10 @@
*/
package org.sonar.duplications.detector.suffixtree;
-import java.util.*;
-
import com.google.common.collect.Lists;
+import java.util.*;
+
public final class Search {
private final SuffixTree tree;
@@ -132,7 +132,7 @@ public final class Search {
reporter.endOfGroup();
}
- public static abstract class Collector {
+ public abstract static class Collector {
/**
* Invoked at the beginning of processing for current node.
@@ -141,7 +141,7 @@ public final class Search {
* thus we guaranty that length will not increase between two sequential calls of this method
* (can be equal or less than previous value).
* </p>
- *
+ *
* @param size number of parts in group
* @param length length of each part in group
*/
@@ -149,7 +149,7 @@ public final class Search {
/**
* Invoked as many times as leafs in the subtree, where current node is root.
- *
+ *
* @param start start position in generalised text
* @param end end position in generalised text
*/
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java
index 3b91fda8397..f0a5cf93df6 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java
@@ -27,6 +27,7 @@ import org.sonar.api.database.BaseIdentifiable;
import org.sonar.api.database.DatabaseSession;
import javax.persistence.*;
+
import java.util.Date;
/**
@@ -39,12 +40,12 @@ public class Snapshot extends BaseIdentifiable {
/**
* This status is set on the snapshot at the beginning of the batch
*/
- public final static String STATUS_UNPROCESSED = "U";
+ public static final String STATUS_UNPROCESSED = "U";
/**
* This status is set on the snapshot at the end of the batch
*/
- public final static String STATUS_PROCESSED = "P";
+ public static final String STATUS_PROCESSED = "P";
@Column(name = "project_id", updatable = true, nullable = true)
private Integer resourceId;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
index ca3a6f4ffe0..44008b1b2be 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
@@ -38,7 +38,7 @@ public class Measure {
/**
* Default precision when saving a float type metric
*/
- public final static int DEFAULT_PRECISION = 1;
+ public static final int DEFAULT_PRECISION = 1;
private Long id; // for internal use
protected String metricKey;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java
index 0eb8c454d42..44f452d0293 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java
@@ -159,7 +159,7 @@ public final class MeasuresFilters {
/**
* Used for internal optimizations.
*/
- public static abstract class MetricFilter<M> implements MeasuresFilter<M> {
+ public abstract static class MetricFilter<M> implements MeasuresFilter<M> {
private final String metricKey;
protected MetricFilter(Metric metric) {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java
index 853bdd7446c..c51106adb25 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java
@@ -19,24 +19,17 @@
*/
package org.sonar.api.measures;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.sonar.api.BatchExtension;
import org.sonar.api.ServerExtension;
+import javax.persistence.*;
+
/**
* This class represents the definition of a metric in Sonar.
- *
+ *
* @since 1.10
*/
@Table(name = "metrics")
@@ -46,15 +39,15 @@ public class Metric implements ServerExtension, BatchExtension {
/**
* A metric bigger value means a degradation
*/
- public final static int DIRECTION_WORST = -1;
+ public static final int DIRECTION_WORST = -1;
/**
* A metric bigger value means an improvement
*/
- public final static int DIRECTION_BETTER = 1;
+ public static final int DIRECTION_BETTER = 1;
/**
* The metric direction has no meaning
*/
- public final static int DIRECTION_NONE = 0;
+ public static final int DIRECTION_NONE = 0;
public enum ValueType {
INT, FLOAT, PERCENT, BOOL, STRING, MILLISEC, DATA, LEVEL, DISTRIB, RATING
@@ -593,8 +586,8 @@ public class Metric implements ServerExtension, BatchExtension {
}
/**
- * Metric.Builder is used to create metric definitions. It must be preferred to creating new instances of the Metric class directly.
- *
+ * Metric.Builder is used to create metric definitions. It must be preferred to creating new instances of the Metric class directly.
+ *
* @since 2.7
*/
public static final class Builder {
@@ -615,7 +608,7 @@ public class Metric implements ServerExtension, BatchExtension {
/**
* Creates a new {@link Builder} object.
- *
+ *
* @param key the metric key, should be unique among all metrics
* @param name the metric name
* @param type the metric type
@@ -637,7 +630,7 @@ public class Metric implements ServerExtension, BatchExtension {
/**
* Sets the metric description.
- *
+ *
* @param d the description
* @return the builder
*/
@@ -658,7 +651,7 @@ public class Metric implements ServerExtension, BatchExtension {
* @see Metric#DIRECTION_WORST
* @see Metric#DIRECTION_BETTER
* @see Metric#DIRECTION_NONE
- *
+ *
* @param d the direction
* @return the builder
*/
@@ -671,7 +664,7 @@ public class Metric implements ServerExtension, BatchExtension {
* Sets whether the metric is qualitative or not. Default value is false.
* <br/>
* If set to true, then variations of this metric will be highlighted in the Web UI (for instance, trend icons will be red or green instead of default grey).
- *
+ *
* @param b Boolean.TRUE if the metric is qualitative
* @return the builder
*/
@@ -684,7 +677,7 @@ public class Metric implements ServerExtension, BatchExtension {
* Sets the domain for the metric (General, Complexity...). This is used to group metrics in the Web UI.
* <br/>
* By default, the metric belongs to no specific domain.
- *
+ *
* @param d the domain
* @return the builder
*/
@@ -701,10 +694,10 @@ public class Metric implements ServerExtension, BatchExtension {
* <br/>
* When a formula is set, sensors/decorators just need to store measures at a specific level and let Sonar run the formula to store
* measures on the remaining levels.
- *
- * @see {@link SumChildDistributionFormula}, {@link SumChildValuesFormula}, {@link AverageComplexityFormula}, {@link MeanAggregationFormula},
+ *
+ * @see {@link SumChildDistributionFormula}, {@link SumChildValuesFormula}, {@link AverageComplexityFormula}, {@link MeanAggregationFormula},
* {@link WeightedMeanAggregationFormula}
- *
+ *
* @param f the formula
* @return the builder
*/
@@ -715,7 +708,7 @@ public class Metric implements ServerExtension, BatchExtension {
/**
* Sets the worst value that the metric can get (example: 0.0 for code coverage). No worst value is set by default.
- *
+ *
* @param d the worst value
* @return the builder
*/
@@ -728,7 +721,7 @@ public class Metric implements ServerExtension, BatchExtension {
* Sets the best value that the metric can get (example: 100.0 for code coverage). No best value is set by default.
* <br/>
* Resources would be hidden on drilldown page, if the value of measure equals to best value.
- *
+ *
* @param d the best value
* @return the builder
*/
@@ -740,9 +733,9 @@ public class Metric implements ServerExtension, BatchExtension {
/**
* Specifies whether file-level measures that equal to the defined best value are stored or not. Default is false.
* <br/>
- * Example with the metric that stores the number of violation ({@link CoreMetrics#VIOLATIONS}):
+ * Example with the metric that stores the number of violation ({@link CoreMetrics#VIOLATIONS}):
* if a file has no violation, then the value '0' won't be stored in the database.
- *
+ *
* @param b true if the measures must not be stored when they equal to the best value
* @return the builder
*/
@@ -753,7 +746,7 @@ public class Metric implements ServerExtension, BatchExtension {
/**
* Sets whether the metric should be hidden in Web UI (e.g. in Time Machine). Default is false.
- *
+ *
* @param b true if the metric should be hidden.
* @return the builder
*/
@@ -766,9 +759,9 @@ public class Metric implements ServerExtension, BatchExtension {
* Specifies whether this metric can be edited online in the "Manual measures" page. Default is false.
*
* @since 2.10
- *
+ *
* @param b true if the metric can be edited online.
- * @return the builder
+ * @return the builder
*/
public Builder setUserManaged(boolean b) {
this.userManaged = b;
@@ -781,7 +774,7 @@ public class Metric implements ServerExtension, BatchExtension {
* By default, historical data are kept.
*
* @since 2.14
- *
+ *
* @param b true if measures from the past can be deleted automatically.
* @return the builder
*/
@@ -792,7 +785,7 @@ public class Metric implements ServerExtension, BatchExtension {
/**
* Creates a new metric definition based on the properties set on this metric builder.
- *
+ *
* @return a new {@link Metric} object
*/
public Metric create() {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java
index 8a899c7444f..7c3b48bfc3b 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java
@@ -28,6 +28,7 @@ import org.sonar.api.database.DatabaseProperties;
import org.sonar.check.Cardinality;
import javax.persistence.*;
+
import java.util.ArrayList;
import java.util.List;
@@ -35,7 +36,7 @@ import java.util.List;
@Table(name = "rules")
public final class Rule {
- private final static RulesCategory NONE = new RulesCategory("none");
+ private static final RulesCategory NONE = new RulesCategory("none");
@Id
@Column(name = "id")
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java
index 7a8c893edb1..6f004c963ba 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java
@@ -48,7 +48,7 @@ public final class KeyValueFormat {
// only static methods
}
- public static abstract class Converter<TYPE> {
+ public abstract static class Converter<TYPE> {
abstract String format(TYPE type);
abstract TYPE parse(String s);
diff --git a/sonar-squid/src/main/java/org/sonar/squid/text/Line.java b/sonar-squid/src/main/java/org/sonar/squid/text/Line.java
index eb7188630d3..f468b090162 100644
--- a/sonar-squid/src/main/java/org/sonar/squid/text/Line.java
+++ b/sonar-squid/src/main/java/org/sonar/squid/text/Line.java
@@ -26,6 +26,8 @@ import org.sonar.squid.measures.Metric;
class Line implements Measurable<Metric> {
+ private static final String NOSONAR_TAG = "NOSONAR";
+
private final int lineIndex;
private int blankLine = 0;
private int line = 1;
@@ -39,7 +41,6 @@ class Line implements Measurable<Metric> {
private boolean isBlank;
private boolean isThereJavadoc;
private boolean isThereLicenseHeaderComment;
- private final static String NOSONAR_TAG = "NOSONAR";
Line() {
this.lineIndex = 0;
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java
index 633377d0d70..5b8cb0ad89c 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java
@@ -22,7 +22,7 @@ package org.sonar.wsclient.services;
public class ResourceQuery extends Query<Resource> {
public static final String BASE_URL = "/api/resources";
- public final static int DEPTH_UNLIMITED = -1;
+ public static final int DEPTH_UNLIMITED = -1;
private Integer depth;
private String resourceKeyOrId;