]> source.dussan.org Git - sonarqube.git/commitdiff
fix missing class constructor (mostly GSon serialized classes)
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Thu, 10 Oct 2019 12:16:32 +0000 (14:16 +0200)
committerSonarTech <sonartech@sonarsource.com>
Mon, 14 Oct 2019 18:21:05 +0000 (20:21 +0200)
13 files changed:
server/sonar-auth-gitlab/src/main/java/org/sonar/auth/gitlab/GsonUser.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/api/measurecomputer/MeasureComputerDefinitionImpl.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/batch/BatchReportDirectoryHolderImpl.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ComponentTreeBuilder.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/DisabledComponentsHolderImpl.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/TreeRootHolderImpl.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filesystem/ComputationTempFolderProvider.java
server/sonar-db-dao/src/main/java/org/sonar/db/newcodeperiod/NewCodePeriodDto.java
sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/server/RulesDefinitionContext.java
sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginInstaller.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/ReportParser.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultMetricsRepositoryLoader.java

index b7d4e0e6825288535847188a2ddcf8257002e7e3..6d9469405d291485ae7c69d23bf588f3d3f7b4de 100644 (file)
@@ -30,6 +30,12 @@ public class GsonUser {
   private String name;
   private String email;
 
+  public GsonUser() {
+    // even if empty constructor is not required for Gson, it is strongly
+    // recommended:
+    // http://stackoverflow.com/a/18645370/229031
+  }
+
   public long getId() {
     return id;
   }
index ed4e81292d592e1cc8c907807018df14dacf6ca3..aebe6263f0340450967213bc1663bdcffbab39f4 100644 (file)
@@ -84,7 +84,7 @@ public class MeasureComputerDefinitionImpl implements MeasureComputer.MeasureCom
 
     private String[] inputMetricKeys = new String[] {};
     @CheckForNull
-    private String[] outputMetrics;
+    private String[] outputMetrics = null;
 
     @Override
     public Builder setInputMetrics(String... inputMetrics) {
index ca8f5c9bb32652ba4804e029d5644d8575727ea5..690b6d816d6c612cd6588732f898d1b994d6f099 100644 (file)
@@ -24,7 +24,7 @@ import java.util.Objects;
 
 public class BatchReportDirectoryHolderImpl implements MutableBatchReportDirectoryHolder {
 
-  private File directory;
+  private File directory = null;
 
   @Override
   public void setDirectory(File newDirectory) {
index 9c042f30f4c56a650efb2e0a4f04f6073eda88e5..d769a15d82514b95e0e2bd9629219d3f5aa93e6a 100644 (file)
@@ -351,7 +351,7 @@ public class ComponentTreeBuilder {
 
   private static class Node {
     private final Map<String, Node> children = new LinkedHashMap<>();
-    private ScannerReport.Component reportComponent;
+    private ScannerReport.Component reportComponent = null;
 
     private Map<String, Node> children() {
       return children;
index e697f0385f3565565f11dc91b870459844a3355e..48173bf3702b7603fbd3c993508bd458b06b90b3 100644 (file)
@@ -25,7 +25,7 @@ import static com.google.common.base.Preconditions.checkState;
 
 public class DisabledComponentsHolderImpl implements MutableDisabledComponentsHolder {
 
-  private Set<String> uuids;
+  private Set<String> uuids = null;
 
   @Override
   public Set<String> getUuids() {
index 4d0d38e708ff914a50353d4f9dca065be26ea0a1..4115995ad658c5a7b913c80e8f445986d2b155af 100644 (file)
@@ -33,14 +33,12 @@ import static org.sonar.ce.task.projectanalysis.component.ComponentVisitor.Order
  */
 public class TreeRootHolderImpl implements MutableTreeRootHolder {
   @CheckForNull
-  private Map<Integer, Component> componentsByRef;
-
+  private Map<Integer, Component> componentsByRef = null;
   @CheckForNull
-  private Map<Integer, Component> extendedComponentsByRef;
-
-  private int size;
-  private Component root;
-  private Component extendedTreeRoot;
+  private Map<Integer, Component> extendedComponentsByRef = null;
+  private int size = 0;
+  private Component root = null;
+  private Component extendedTreeRoot = null;
 
   @Override
   public boolean isEmpty() {
index be955030af4c662076586cd91b962870d819f65d..9ffd6a318081a39e27783d5d7f2cdb9e8f156ec2 100644 (file)
@@ -38,7 +38,7 @@ import org.sonar.server.platform.ServerFileSystem;
 public class ComputationTempFolderProvider extends ProviderAdapter implements ComponentLifecycle<TempFolder> {
   private boolean started = false;
   @CheckForNull
-  private DefaultTempFolder tempFolder;
+  private DefaultTempFolder tempFolder = null;
 
   public TempFolder provide(ServerFileSystem fs) {
     if (this.tempFolder == null) {
index 538e33c79eb4abe0fff3217bc9540cbe5d89c50d..fe82c475d2dca8aba95111d65f22116556327a48 100644 (file)
@@ -22,13 +22,13 @@ package org.sonar.db.newcodeperiod;
 import javax.annotation.CheckForNull;
 
 public class NewCodePeriodDto {
-  private String uuid;
-  private String projectUuid;
-  private String branchUuid;
-  private NewCodePeriodType type;
-  private String value;
-  private long updatedAt;
-  private long createdAt;
+  private String uuid = null;
+  private String projectUuid = null;
+  private String branchUuid = null;
+  private NewCodePeriodType type = null;
+  private String value = null;
+  private long updatedAt = 0L;
+  private long createdAt = 0L;
 
   public static NewCodePeriodDto defaultInstance() {
     return new NewCodePeriodDto().setType(NewCodePeriodType.PREVIOUS_VERSION);
index 96a63d1cdfa9138efb83b2af30f27c0ff9392b12..581e0552cef842285f4de9919716831e5d20064c 100644 (file)
@@ -36,7 +36,7 @@ import static org.sonar.api.utils.Preconditions.checkState;
 
 public class RulesDefinitionContext extends RulesDefinition.Context {
   private final Map<String, RulesDefinition.Repository> repositoriesByKey = new HashMap<>();
-  private String currentPluginKey;
+  private String currentPluginKey = null;
 
   @Override
   public RulesDefinition.NewRepository createRepository(String key, String language) {
index c55ca6ce55038cd7bbb6f684094d64705104c905..2fdd1ba58b84e93330cf2b2ad85b8f8825efd0d1 100644 (file)
@@ -359,7 +359,7 @@ public interface RulesDefinition {
    */
   class Context extends AbstractContext {
     private final Map<String, Repository> repositoriesByKey = new HashMap<>();
-    private String currentPluginKey;
+    private String currentPluginKey = null;
 
     @Override
     public RulesDefinition.NewRepository createRepository(String key, String language) {
index d80a52a26e9f8e0f501494482f922be18b89f35c..fa7d0cc7764a9ae618a94e290919955d06384e46 100644 (file)
@@ -112,12 +112,20 @@ public class ScannerPluginInstaller implements PluginInstaller {
 
   private static class InstalledPlugins {
     InstalledPlugin[] plugins;
+
+    public InstalledPlugins() {
+      // http://stackoverflow.com/a/18645370/229031
+    }
   }
 
   static class InstalledPlugin {
     String key;
     String hash;
     long updatedAt;
+
+    public InstalledPlugin() {
+      // http://stackoverflow.com/a/18645370/229031
+    }
   }
 
   private static class Loaded {
index 0c7d0039d9a35717c217c4d63afffb64e5cf42d5..f5dd98533845ba39d365f5148308e48b7241deb6 100644 (file)
@@ -101,6 +101,10 @@ public class ReportParser {
 
   static class Report {
     Issue[] issues;
+
+    public Report() {
+      // http://stackoverflow.com/a/18645370/229031
+    }
   }
 
   static class Issue {
@@ -113,6 +117,10 @@ public class ReportParser {
     Location primaryLocation;
     @Nullable
     Location[] secondaryLocations;
+
+    public Issue() {
+      // http://stackoverflow.com/a/18645370/229031
+    }
   }
 
   static class Location {
@@ -121,6 +129,10 @@ public class ReportParser {
     String filePath;
     @Nullable
     TextRange textRange;
+
+    public Location() {
+      // http://stackoverflow.com/a/18645370/229031
+    }
   }
 
   static class TextRange {
@@ -131,5 +143,9 @@ public class ReportParser {
     Integer endLine;
     @Nullable
     Integer endColumn;
+
+    public TextRange() {
+      // http://stackoverflow.com/a/18645370/229031
+    }
   }
 }
index 7afc0c68587a806827f0984fddd5229d7da62493..bea74d58c8e34fd7e95c03abbe0ffb56d5701c4c 100644 (file)
@@ -123,6 +123,10 @@ public class DefaultMetricsRepositoryLoader implements MetricsRepositoryLoader {
 
     private int ps;
 
+    public WsMetricsResponse() {
+      // http://stackoverflow.com/a/18645370/229031
+    }
+
     public int getTotal() {
       return total;
     }