]> source.dussan.org Git - sonarqube.git/commitdiff
Fix Quality flaws
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 20 Jun 2017 11:52:28 +0000 (13:52 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 20 Jun 2017 11:52:57 +0000 (13:52 +0200)
sonar-plugin-api/src/main/java/org/sonar/api/batch/debt/DebtRemediationFunction.java
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/CoverageType.java
sonar-plugin-api/src/main/java/org/sonar/api/rule/Severity.java

index 602d8ebeb1aa70c478752e573b42a73b8a1acb0b..44917519e7226cc8459ce5ed30dfef931d0537d9 100644 (file)
@@ -85,10 +85,10 @@ public class DebtRemediationFunction {
     if (type != that.type) {
       return false;
     }
-    if (coefficient != null ? !coefficient.equals(that.coefficient) : that.coefficient != null) {
+    if ((coefficient != null) ? !coefficient.equals(that.coefficient) : (that.coefficient != null)) {
       return false;
     }
-    return offset != null ? offset.equals(that.offset) : that.offset == null;
+    return (offset != null) ? offset.equals(that.offset) : (that.offset == null);
   }
 
   @Override
index b0f397623fcb5caf309e4a012f3eaded605f1fdf..c3ef537cac2b0a9d347fa61e8418160cbaf57c69 100644 (file)
  */
 package org.sonar.api.batch.sensor.coverage;
 
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.LinkedHashSet;
 import java.util.Set;
 import org.sonar.api.measures.Metric;
 
+import static java.util.Arrays.asList;
 import static org.sonar.api.measures.CoreMetrics.CONDITIONS_BY_LINE;
 import static org.sonar.api.measures.CoreMetrics.CONDITIONS_TO_COVER;
 import static org.sonar.api.measures.CoreMetrics.COVERAGE_LINE_HITS_DATA;
@@ -79,8 +79,8 @@ public enum CoverageType {
     this.uncoveredConditions = uncoveredConditions;
     this.coveredConditionsByLine = coveredConditionsByLine;
     this.conditionsByLine = conditionsByLine;
-    this.all = Collections
-      .unmodifiableSet(new LinkedHashSet<>(Arrays.asList(linesToCover, uncoveredLines, lineHitsData, conditionsToCover, uncoveredConditions, coveredConditionsByLine, conditionsByLine)));
+    this.all = Collections.unmodifiableSet(new LinkedHashSet<>(
+      asList(linesToCover, uncoveredLines, lineHitsData, conditionsToCover, uncoveredConditions, coveredConditionsByLine, conditionsByLine)));
   }
 
   public Set<Metric> allMetrics() {
index 385b3a2b32e6cd84114f6df215a1278162132e43..8faf14504fa786efc87e91980551db9ce9937745 100644 (file)
@@ -22,6 +22,7 @@ package org.sonar.api.rule;
 import java.util.List;
 
 import static java.util.Arrays.asList;
+import static java.util.Collections.unmodifiableList;
 
 /**
  * @since 3.6
@@ -37,7 +38,7 @@ public final class Severity {
   /**
    * All the supported severity values, ordered from {@link #INFO} to {@link #BLOCKER}.
    */
-  public static final List<String> ALL = asList(INFO, MINOR, MAJOR, CRITICAL, BLOCKER);
+  public static final List<String> ALL = unmodifiableList(asList(INFO, MINOR, MAJOR, CRITICAL, BLOCKER));
 
   private Severity() {
     // utility