Fix errors against latest Gerrit core

The core change (I7e9c51846) which fixes DynamicOptions to support
custom beans modified the signature of DynamicOptions(). Also, another
core change (Ifc8316278) which tries to avoid the usage of ChangeIndex
removes createChecked(Change.Id) method. Due to which the build for
the tip version of batch plugin fails.

Change-Id: I03b79282804d23bdab74ef575dcb4a28d1e68c77
diff --git a/src/main/java/com/googlesource/gerrit/plugins/batch/BatchSubmitter.java b/src/main/java/com/googlesource/gerrit/plugins/batch/BatchSubmitter.java
index a2729b7..546ae42 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/batch/BatchSubmitter.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/batch/BatchSubmitter.java
@@ -138,18 +138,22 @@
     if (dest.changes != null) {
       // TODO: Is using the first change in the batch for each dest the correct thing to do?
       Change firstInDest =
-          notesFactory.createChecked(dest.changes.get(0).toPatchSetId().changeId()).getChange();
+          notesFactory
+              .createChecked(
+                  Project.nameKey(dest.project), dest.changes.get(0).toPatchSetId().changeId())
+              .getChange();
       SubmissionId submissionId = new SubmissionId(firstInDest);
       for (Batch.Change change : dest.changes) {
-        closeChange(change.toPatchSetId(), dest.sha1, submissionId);
+        closeChange(Project.nameKey(dest.project), change.toPatchSetId(), dest.sha1, submissionId);
       }
     }
   }
 
-  private void closeChange(PatchSet.Id psId, String sha1, SubmissionId submissionId)
+  private void closeChange(
+      Project.NameKey destProject, PatchSet.Id psId, String sha1, SubmissionId submissionId)
       throws IOException, RepositoryNotFoundException, RestApiException, UpdateException,
           PermissionBackendException {
-    ChangeNotes changeNotes = notesFactory.createChecked(psId.changeId());
+    ChangeNotes changeNotes = notesFactory.createChecked(destProject, psId.changeId());
     permissionBackend.user(user).change(changeNotes).check(ChangePermission.READ);
     Change change = changeNotes.getChange();
     PatchSet ps = psUtil.get(changeNotes, psId);
diff --git a/src/main/java/com/googlesource/gerrit/plugins/batch/cli/PatchSetArgument.java b/src/main/java/com/googlesource/gerrit/plugins/batch/cli/PatchSetArgument.java
index 78d173a..1142882 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/batch/cli/PatchSetArgument.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/batch/cli/PatchSetArgument.java
@@ -47,7 +47,7 @@
     public PatchSetArgument createForArgument(String token) {
       try {
         PatchSet.Id patchSetId = parsePatchSet(token);
-        ChangeNotes changeNotes = notesFactory.createChecked(patchSetId.changeId());
+        ChangeNotes changeNotes = notesFactory.createCheckedUsingIndexLookup(patchSetId.changeId());
         permissionBackend.user(user).change(changeNotes).check(ChangePermission.READ);
         return new PatchSetArgument(changeNotes.getChange(), psUtil.get(changeNotes, patchSetId));
       } catch (PermissionBackendException | AuthException e) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/batch/ssh/ListCommand.java b/src/main/java/com/googlesource/gerrit/plugins/batch/ssh/ListCommand.java
index 42edd43..2ffaa5b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/batch/ssh/ListCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/batch/ssh/ListCommand.java
@@ -38,8 +38,7 @@
         new CommandRunnable() {
           @Override
           public void run() throws Exception {
-            try (DynamicOptions pluginOptions =
-                new DynamicOptions(ListCommand.this, injector, dynamicBeans)) {
+            try (DynamicOptions pluginOptions = new DynamicOptions(injector, dynamicBeans)) {
               parseCommandLine(impl, pluginOptions);
               impl.display(out);
             }