Add NotImplemented default implementations for all code owner APIs

This allows source compatibility when adding new methods to the
interfaces.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: Ie4cdd810a9ec1ada31ae04dcc3c229b2d71202ad
diff --git a/java/com/google/gerrit/plugins/codeowners/api/BranchCodeOwners.java b/java/com/google/gerrit/plugins/codeowners/api/BranchCodeOwners.java
index c4dfaac..8ff1222 100644
--- a/java/com/google/gerrit/plugins/codeowners/api/BranchCodeOwners.java
+++ b/java/com/google/gerrit/plugins/codeowners/api/BranchCodeOwners.java
@@ -15,6 +15,7 @@
 package com.google.gerrit.plugins.codeowners.api;
 
 import com.google.gerrit.common.Nullable;
+import com.google.gerrit.extensions.restapi.NotImplementedException;
 import com.google.gerrit.extensions.restapi.RestApiException;
 import java.util.List;
 
@@ -49,4 +50,15 @@
     /** Executes the request and retrieves the paths of the requested code owner config file */
     public abstract List<String> paths() throws RestApiException;
   }
+
+  /**
+   * A default implementation which allows source compatibility when adding new methods to the
+   * interface.
+   */
+  class NotImplemented implements BranchCodeOwners {
+    @Override
+    public CodeOwnerConfigFilesRequest codeOwnerConfigFiles() throws RestApiException {
+      throw new NotImplementedException();
+    }
+  }
 }
diff --git a/java/com/google/gerrit/plugins/codeowners/api/ProjectCodeOwners.java b/java/com/google/gerrit/plugins/codeowners/api/ProjectCodeOwners.java
index d4a839a..4d5159f 100644
--- a/java/com/google/gerrit/plugins/codeowners/api/ProjectCodeOwners.java
+++ b/java/com/google/gerrit/plugins/codeowners/api/ProjectCodeOwners.java
@@ -17,6 +17,7 @@
 import com.google.common.collect.ImmutableList;
 import com.google.gerrit.common.Nullable;
 import com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.ConsistencyProblemInfo;
+import com.google.gerrit.extensions.restapi.NotImplementedException;
 import com.google.gerrit.extensions.restapi.RestApiException;
 import java.util.List;
 import java.util.Map;
@@ -109,4 +110,25 @@
 
   /** Returns the branch-level code owners API for the given branch. */
   BranchCodeOwners branch(String branchName) throws RestApiException;
+
+  /**
+   * A default implementation which allows source compatibility when adding new methods to the
+   * interface.
+   */
+  class NotImplemented implements ProjectCodeOwners {
+    @Override
+    public CodeOwnerProjectConfigInfo getConfig() throws RestApiException {
+      throw new NotImplementedException();
+    }
+
+    @Override
+    public CheckCodeOwnerConfigFilesRequest checkCodeOwnerConfigFiles() throws RestApiException {
+      throw new NotImplementedException();
+    }
+
+    @Override
+    public BranchCodeOwners branch(String branchName) throws RestApiException {
+      throw new NotImplementedException();
+    }
+  }
 }