VisibilityChecker#isReachableFrom: Remove unused param and exceptions

The current signature of #isReachableFrom has couple of wrinkles: the
description is not used and the only caller of this method doesn't
differentiate the subclasses of IOException.

Fixing the method now, before deleting the deprecated variant, helps
downstream transition: subclasses can move to the updated API and
ignore the deprecated variant. If we want to change this later,
downstream needs to update at the same time than the superclass.

Update also the tests, to use the "new" variant.

Change-Id: If31043ab711a7a287ebf5529e2823fc8ed73ed97
diff --git a/java/com/google/gitiles/VisibilityCache.java b/java/com/google/gitiles/VisibilityCache.java
index 1d0467a..ea11d4f 100644
--- a/java/com/google/gitiles/VisibilityCache.java
+++ b/java/com/google/gitiles/VisibilityCache.java
@@ -174,7 +174,7 @@
             .map(objId -> VisibilityChecker.objectIdToRevCommit(walk, objId))
             .filter(Objects::nonNull); // Ignore missing tips
 
-    return checker.isReachableFrom("known and sorted refs", walk, commit, startCommits);
+    return checker.isReachableFrom(walk, commit, startCommits);
   }
 
   static Stream<Ref> importantRefsFirst(Collection<Ref> visibleRefs) {
diff --git a/java/com/google/gitiles/VisibilityChecker.java b/java/com/google/gitiles/VisibilityChecker.java
index 4c4ac3a..49a6402 100644
--- a/java/com/google/gitiles/VisibilityChecker.java
+++ b/java/com/google/gitiles/VisibilityChecker.java
@@ -20,8 +20,6 @@
 import java.util.Objects;
 import java.util.stream.Stream;
 import org.eclipse.jgit.annotations.Nullable;
-import org.eclipse.jgit.errors.IncorrectObjectTypeException;
-import org.eclipse.jgit.errors.MissingObjectException;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.lib.RefDatabase;
 import org.eclipse.jgit.revwalk.RevCommit;
@@ -62,7 +60,7 @@
    *     or ids referring to other kinds of objects are ignored.
    * @return true if we can get to {@code commit} from the {@code starters}
    * @throws IOException a pack file or loose object could not be read
-   * @deprecated see {@link #isReachableFrom(String, RevWalk, RevCommit, Stream)}
+   * @deprecated see {@link #isReachableFrom(RevWalk, RevCommit, Stream)}
    */
   @Deprecated
   protected boolean isReachableFrom(
@@ -70,13 +68,12 @@
       throws IOException {
     Stream<RevCommit> startCommits =
         starters.stream().map(objId -> objectIdToRevCommit(walk, objId)).filter(Objects::nonNull);
-    return isReachableFrom(description, walk, commit, startCommits);
+    return isReachableFrom(walk, commit, startCommits);
   }
 
   /**
    * Check if {@code commit} is reachable starting from {@code starters}.
    *
-   * @param description Description of the ids (e.g. "heads"). Mainly for tracing.
    * @param walk The walk to use for the reachability check
    * @param commit The starting commit. It *MUST* come from the walk in use
    * @param starters visible commits. Anything reachable from these commits is visible. Missing ids
@@ -84,9 +81,8 @@
    * @return true if we can get to {@code commit} from the {@code starters}
    * @throws IOException a pack file or loose object could not be read
    */
-  protected boolean isReachableFrom(
-      String description, RevWalk walk, RevCommit commit, Stream<RevCommit> starters)
-      throws MissingObjectException, IncorrectObjectTypeException, IOException {
+  protected boolean isReachableFrom(RevWalk walk, RevCommit commit, Stream<RevCommit> starters)
+      throws IOException {
     return walk.getObjectReader()
         .createReachabilityChecker(walk)
         .areAllReachable(ImmutableList.of(commit), starters)
diff --git a/javatests/com/google/gitiles/VisibilityCheckerTest.java b/javatests/com/google/gitiles/VisibilityCheckerTest.java
index bf416bb..070de98 100644
--- a/javatests/com/google/gitiles/VisibilityCheckerTest.java
+++ b/javatests/com/google/gitiles/VisibilityCheckerTest.java
@@ -18,12 +18,10 @@
 import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
+import java.util.stream.Stream;
 import org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription;
 import org.eclipse.jgit.internal.storage.dfs.InMemoryRepository;
 import org.eclipse.jgit.junit.TestRepository;
-import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.revwalk.RevCommit;
 import org.eclipse.jgit.revwalk.RevWalk;
 import org.junit.Before;
@@ -78,15 +76,13 @@
 
   @Test
   public void reachableFromRef() throws IOException {
-    List<ObjectId> starters = Arrays.asList(commitC.getId());
-    assertTrue(
-        visibilityChecker.isReachableFrom("test", walk, walk.parseCommit(commitB), starters));
+    Stream<RevCommit> starters = Stream.of(walk.parseCommit(commitC));
+    assertTrue(visibilityChecker.isReachableFrom(walk, walk.parseCommit(commitB), starters));
   }
 
   @Test
   public void unreachableFromRef() throws IOException {
-    List<ObjectId> starters = Arrays.asList(commit2.getId(), commitA.getId());
-    assertFalse(
-        visibilityChecker.isReachableFrom("test", walk, walk.parseCommit(commitC), starters));
+    Stream<RevCommit> starters = Stream.of(walk.parseCommit(commit2), walk.parseCommit(commitA));
+    assertFalse(visibilityChecker.isReachableFrom(walk, walk.parseCommit(commitC), starters));
   }
 }