Annotate methods that return a definitely null value with @Nullable

We intend to enable the ReturnMissingNullable errorprone pattern in
Gerrit core and this fixes the current issues.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I077ad0ddfa8ce0c07dc08cc1e4414e35830cd843
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/command/CloneWithCommitMsgHook.java b/src/main/java/com/googlesource/gerrit/plugins/download/command/CloneWithCommitMsgHook.java
index c21e31c..61e696a 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/command/CloneWithCommitMsgHook.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/command/CloneWithCommitMsgHook.java
@@ -14,6 +14,7 @@
 
 package com.googlesource.gerrit.plugins.download.command;
 
+import com.google.gerrit.common.Nullable;
 import com.google.gerrit.extensions.config.DownloadScheme;
 import com.google.gerrit.server.CurrentUser;
 import com.google.gerrit.server.config.GerritServerConfig;
@@ -43,6 +44,7 @@
     this.userProvider = userProvider;
   }
 
+  @Nullable
   @Override
   public String getCommand(DownloadScheme scheme, String project) {
     Optional<String> username = userProvider.get().getUserName();
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/command/GitDownloadCommand.java b/src/main/java/com/googlesource/gerrit/plugins/download/command/GitDownloadCommand.java
index e106510..d258ec2 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/command/GitDownloadCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/command/GitDownloadCommand.java
@@ -15,6 +15,7 @@
 package com.googlesource.gerrit.plugins.download.command;
 
 import com.google.common.flogger.FluentLogger;
+import com.google.gerrit.common.Nullable;
 import com.google.gerrit.entities.Change;
 import com.google.gerrit.entities.Project;
 import com.google.gerrit.entities.RefNames;
@@ -59,6 +60,7 @@
         cfg.getBoolean(DOWNLOAD, KEY_CHECK_FOR_HIDDEN_CHANGE_REFS, false);
   }
 
+  @Nullable
   @Override
   public final String getCommand(DownloadScheme scheme, String project, String ref) {
     if (commandAllowed) {
@@ -97,6 +99,7 @@
     }
   }
 
+  @Nullable
   private String resolveRef(String project, String ref) {
     if (project.startsWith("$") || ref.startsWith("$")) {
       // No real value but placeholders are being used.
@@ -139,6 +142,7 @@
    * @param url The project URL this change is for.
    * @param id The change/PS numbers.
    */
+  @Nullable
   String getRepoCommand(String url, String id) {
     // Most commands don't support this, so default it to nothing.
     return null;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/AnonymousHttpScheme.java b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/AnonymousHttpScheme.java
index e51cb19..d816b2c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/AnonymousHttpScheme.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/AnonymousHttpScheme.java
@@ -41,6 +41,7 @@
     this.schemeAllowed = downloadConfig.getDownloadSchemes().contains(ANON_HTTP);
   }
 
+  @Nullable
   @Override
   public String getUrl(String project) {
     if (!isEnabled()) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/HttpScheme.java b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/HttpScheme.java
index c8a84e8..8a75f5f 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/HttpScheme.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/HttpScheme.java
@@ -48,6 +48,7 @@
     this.schemeAllowed = downloadConfig.getDownloadSchemes().contains(HTTP);
   }
 
+  @Nullable
   @Override
   public String getUrl(String project) {
     if (!isEnabled() || !userProvider.get().isIdentifiedUser()) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/SshScheme.java b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/SshScheme.java
index 04a6fc2..3f5987b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/SshScheme.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/SshScheme.java
@@ -82,6 +82,7 @@
     this.schemeAllowed = downloadConfig.getDownloadSchemes().contains(SSH);
   }
 
+  @Nullable
   @Override
   public String getUrl(String project) {
     if (!isEnabled() || !userProvider.get().isIdentifiedUser()) {