]> source.dussan.org Git - sonarqube.git/commitdiff
minor fixes
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Wed, 16 Oct 2019 21:19:10 +0000 (16:19 -0500)
committerSonarTech <sonartech@sonarsource.com>
Mon, 21 Oct 2019 18:21:09 +0000 (20:21 +0200)
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/Measure.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoImpl.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/util/cache/DoubleCache.java

index 1bcc58d75292644d5538cd3ccab311fd9d75798e..96f9530be16fce989901160ae98a73356bd2a3f2 100644 (file)
@@ -359,7 +359,6 @@ public interface Measure {
   class NoValueVariationMeasureImpl implements Measure {
     @Nullable
     private Double variation;
-    private ValueType valueType = ValueType.NO_VALUE;
 
     private NoValueVariationMeasureImpl(@Nullable Double variation) {
       this.variation = variation;
@@ -430,7 +429,7 @@ public interface Measure {
     @Override
     public String toString() {
       return com.google.common.base.MoreObjects.toStringHelper(this)
-        .add("valueType", valueType)
+        .add("valueType", ValueType.NO_VALUE)
         .add("variations", variation)
         .toString();
     }
index 44fe0b8f319aeb017644a170209819fae050a50a..c73f5707cebcfd65a1e8e02677e7262bda3e8193 100644 (file)
@@ -51,15 +51,10 @@ public class ScmInfoImpl implements ScmInfo {
 
   @Override
   public Changeset getChangesetForLine(int lineNumber) {
-    if (lineNumber < 1 || lineNumber > lineChangesets.length) {
+    if (!hasChangesetForLine(lineNumber)) {
       throw new IllegalArgumentException("There's no changeset on line " + lineNumber);
-
-    }
-    Changeset changeset = lineChangesets[lineNumber - 1];
-    if (changeset != null) {
-      return changeset;
     }
-    throw new IllegalArgumentException("There's no changeset on line " + lineNumber);
+    return lineChangesets[lineNumber - 1];
   }
 
   @Override
index 5b51ad882e78f9a16f0e638206867a2ef0254054..10d0defaf02b9c17096769dc61cf94aed3185310 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.sonar.ce.task.projectanalysis.util.cache;
 
+import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
 
 public class DoubleCache {
@@ -30,6 +31,7 @@ public class DoubleCache {
     // static only
   }
 
+  @CheckForNull
   public static Double intern(@Nullable Double num) {
     if (ZERO.equals(num)) {
       return ZERO;