diff options
13 files changed, 53 insertions, 21 deletions
diff --git a/server/sonar-auth-gitlab/src/main/java/org/sonar/auth/gitlab/GsonUser.java b/server/sonar-auth-gitlab/src/main/java/org/sonar/auth/gitlab/GsonUser.java index b7d4e0e6825..6d9469405d2 100644 --- a/server/sonar-auth-gitlab/src/main/java/org/sonar/auth/gitlab/GsonUser.java +++ b/server/sonar-auth-gitlab/src/main/java/org/sonar/auth/gitlab/GsonUser.java @@ -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; } diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/api/measurecomputer/MeasureComputerDefinitionImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/api/measurecomputer/MeasureComputerDefinitionImpl.java index ed4e81292d5..aebe6263f03 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/api/measurecomputer/MeasureComputerDefinitionImpl.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/api/measurecomputer/MeasureComputerDefinitionImpl.java @@ -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) { diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/batch/BatchReportDirectoryHolderImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/batch/BatchReportDirectoryHolderImpl.java index ca8f5c9bb32..690b6d816d6 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/batch/BatchReportDirectoryHolderImpl.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/batch/BatchReportDirectoryHolderImpl.java @@ -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) { diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ComponentTreeBuilder.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ComponentTreeBuilder.java index 9c042f30f4c..d769a15d825 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ComponentTreeBuilder.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ComponentTreeBuilder.java @@ -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; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/DisabledComponentsHolderImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/DisabledComponentsHolderImpl.java index e697f0385f3..48173bf3702 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/DisabledComponentsHolderImpl.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/DisabledComponentsHolderImpl.java @@ -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() { diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/TreeRootHolderImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/TreeRootHolderImpl.java index 4d0d38e708f..4115995ad65 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/TreeRootHolderImpl.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/TreeRootHolderImpl.java @@ -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() { diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filesystem/ComputationTempFolderProvider.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filesystem/ComputationTempFolderProvider.java index be955030af4..9ffd6a31808 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filesystem/ComputationTempFolderProvider.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filesystem/ComputationTempFolderProvider.java @@ -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) { diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/newcodeperiod/NewCodePeriodDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/newcodeperiod/NewCodePeriodDto.java index 538e33c79eb..fe82c475d2d 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/newcodeperiod/NewCodePeriodDto.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/newcodeperiod/NewCodePeriodDto.java @@ -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); diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/server/RulesDefinitionContext.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/server/RulesDefinitionContext.java index 96a63d1cdfa..581e0552cef 100644 --- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/server/RulesDefinitionContext.java +++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/server/RulesDefinitionContext.java @@ -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) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java index c55ca6ce550..2fdd1ba58b8 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java @@ -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) { diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginInstaller.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginInstaller.java index d80a52a26e9..fa7d0cc7764 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginInstaller.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginInstaller.java @@ -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 { diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/ReportParser.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/ReportParser.java index 0c7d0039d9a..f5dd9853384 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/ReportParser.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/ReportParser.java @@ -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 + } } } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultMetricsRepositoryLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultMetricsRepositoryLoader.java index 7afc0c68587..bea74d58c8e 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultMetricsRepositoryLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultMetricsRepositoryLoader.java @@ -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; } |