Merge "Remove error method from DiagnosticsHandler."
diff --git a/src/main/java/com/android/tools/r8/CompilationException.java b/src/main/java/com/android/tools/r8/CompilationException.java
index c7477b6..8e1e56c 100644
--- a/src/main/java/com/android/tools/r8/CompilationException.java
+++ b/src/main/java/com/android/tools/r8/CompilationException.java
@@ -9,7 +9,7 @@
  * This is always an expected error and considered a user input issue.
  * A user-understandable message must be provided.
  */
-public class CompilationException extends Exception implements Diagnostic {
+public class CompilationException extends Exception {
   private static final long serialVersionUID = 1L;
 
   /**
diff --git a/src/main/java/com/android/tools/r8/D8.java b/src/main/java/com/android/tools/r8/D8.java
index 19f478a..8a92ef0 100644
--- a/src/main/java/com/android/tools/r8/D8.java
+++ b/src/main/java/com/android/tools/r8/D8.java
@@ -60,26 +60,18 @@
   /**
    * Main API entry for the D8 dexer.
    *
-   * <p>If the D8Command contains a DiagnosticsHandler that does not throw a CompilationException
-   * on error this method returns null if the run fails.
-   *
    * @param command D8 command.
    * @return the compilation result.
    */
   public static D8Output run(D8Command command) throws IOException, CompilationException {
     InternalOptions options = command.getInternalOptions();
-    try {
-      CompilationResult result = runForTesting(command.getInputApp(), options);
-      assert result != null;
-      D8Output output = new D8Output(result.androidApp, command.getOutputMode());
-      if (command.getOutputPath() != null) {
-        output.write(command.getOutputPath());
-      }
-      return output;
-    } catch (CompilationException e) {
-      options.diagnosticsHandler.error(e);
-      return null;
+    CompilationResult result = runForTesting(command.getInputApp(), options);
+    assert result != null;
+    D8Output output = new D8Output(result.androidApp, command.getOutputMode());
+    if (command.getOutputPath() != null) {
+      output.write(command.getOutputPath());
     }
+    return output;
   }
 
   /**
@@ -88,9 +80,6 @@
    * <p>The D8 dexer API is intentionally limited and should "do the right thing" given a set of
    * inputs. If the API does not suffice please contact the R8 team.
    *
-   * <p>If the D8Command contains a DiagnosticsHandler that does not throw a CompilationException
-   * on error this method returns null if the run fails.
-   *
    * @param command D8 command.
    * @param executor executor service from which to get threads for multi-threaded processing.
    * @return the compilation result
@@ -98,19 +87,14 @@
   public static D8Output run(D8Command command, ExecutorService executor)
       throws IOException, CompilationException {
     InternalOptions options = command.getInternalOptions();
-    try {
-      CompilationResult result = runForTesting(
-          command.getInputApp(), options, executor);
-      assert result != null;
-      D8Output output = new D8Output(result.androidApp, command.getOutputMode());
-      if (command.getOutputPath() != null) {
-        output.write(command.getOutputPath());
-      }
-      return output;
-    } catch (CompilationException e) {
-      options.diagnosticsHandler.error(e);
-      return null;
+    CompilationResult result = runForTesting(
+        command.getInputApp(), options, executor);
+    assert result != null;
+    D8Output output = new D8Output(result.androidApp, command.getOutputMode());
+    if (command.getOutputPath() != null) {
+      output.write(command.getOutputPath());
     }
+    return output;
   }
 
   private static void run(String[] args) throws IOException, CompilationException {
diff --git a/src/main/java/com/android/tools/r8/DiagnosticsHandler.java b/src/main/java/com/android/tools/r8/DiagnosticsHandler.java
index 4a89c6f..19d6fdc 100644
--- a/src/main/java/com/android/tools/r8/DiagnosticsHandler.java
+++ b/src/main/java/com/android/tools/r8/DiagnosticsHandler.java
@@ -6,23 +6,11 @@
 /**
  * A DiagnosticsHandler can be provided to customize handling of diagnostics information.
  *
- * <p>During compilation the error, warning and info methods will be called.
+ * <p>During compilation the warning and info methods will be called.
  */
 public interface DiagnosticsHandler {
 
   /**
-   * Handle error diagnostics.
-   *
-   * <p>By default this throws the exception.
-   *
-   * @param error CompilationException containing error information.
-   * @throws CompilationException
-   */
-  default void error(CompilationException error) throws CompilationException {
-    throw error;
-  }
-
-  /**
    * Handle warning diagnostics.
    *
    * @param warning Diagnostic containing warning information.
diff --git a/src/main/java/com/android/tools/r8/R8.java b/src/main/java/com/android/tools/r8/R8.java
index 940e110..5b28e78 100644
--- a/src/main/java/com/android/tools/r8/R8.java
+++ b/src/main/java/com/android/tools/r8/R8.java
@@ -398,9 +398,6 @@
    * <p>The R8 API is intentionally limited and should "do the right thing" given a command. If this
    * API does not suffice please contact the R8 team.
    *
-   * <p>If the R8Command contains a DiagnosticsHandler that does not throw a CompilationException
-   * on error this method returns null if the run fails.
-   *
    * @param command R8 command.
    * @return the compilation result.
    */
@@ -481,9 +478,6 @@
    * <p>The R8 API is intentionally limited and should "do the right thing" given a command. If this
    * API does not suffice please contact the R8 team.
    *
-   * <p>If the R8Command contains a DiagnosticsHandler that does not throw a CompilationException
-   * on error this method returns null if the run fails.
-   *
    * @param command R8 command.
    * @param executor executor service from which to get threads for multi-threaded processing.
    * @return the compilation result.
@@ -491,15 +485,10 @@
   public static AndroidApp run(R8Command command, ExecutorService executor)
       throws IOException, CompilationException {
     InternalOptions options = command.getInternalOptions();
-    try {
-      AndroidApp outputApp =
-          runForTesting(command.getInputApp(), options, executor).androidApp;
-      writeOutputs(command, options, outputApp);
-      return outputApp;
-    } catch (CompilationException e) {
-      options.diagnosticsHandler.error(e);
-      return null;
-    }
+    AndroidApp outputApp =
+        runForTesting(command.getInputApp(), options, executor).androidApp;
+    writeOutputs(command, options, outputApp);
+    return outputApp;
   }
 
   private static void run(String[] args)