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: I4bd1ff5d6cce8c1c4babe8cbd9f2266365e63987
diff --git a/src/main/java/com/googlesource/gerrit/plugins/gitiles/FilteredRepository.java b/src/main/java/com/googlesource/gerrit/plugins/gitiles/FilteredRepository.java index f2f842c..1ff6af0 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/gitiles/FilteredRepository.java +++ b/src/main/java/com/googlesource/gerrit/plugins/gitiles/FilteredRepository.java
@@ -17,6 +17,7 @@ import static java.util.stream.Collectors.toMap; import com.google.common.collect.ImmutableList; +import com.google.gerrit.common.Nullable; import com.google.gerrit.entities.Project; import com.google.gerrit.extensions.restapi.AuthException; import com.google.gerrit.server.CurrentUser; @@ -166,6 +167,7 @@ throw new UnsupportedOperationException(); // Gitiles is read-only. } + @Nullable @Override public ReflogReader getReflogReader(String refName) throws IOException { return exactRef(refName) != null ? delegate.getReflogReader(refName) : null; @@ -210,6 +212,7 @@ throw new UnsupportedOperationException(); // Gitiles is read-only. } + @Nullable @Override public Ref exactRef(String name) throws IOException { Ref ref = git.getRefDatabase().exactRef(name);