diff --git a/check_api/src/main/java/com/google/errorprone/apply/DescriptionBasedDiff.java b/check_api/src/main/java/com/google/errorprone/apply/DescriptionBasedDiff.java index 8f9b5827be7..1c11b94ea06 100644 --- a/check_api/src/main/java/com/google/errorprone/apply/DescriptionBasedDiff.java +++ b/check_api/src/main/java/com/google/errorprone/apply/DescriptionBasedDiff.java @@ -109,7 +109,7 @@ public void handleFix(Fix fix) { } @Override - public void applyDifferences(SourceFile sourceFile) throws DiffNotApplicableException { + public void applyDifferences(SourceFile sourceFile) { if (!importsToAdd.isEmpty() || !importsToRemove.isEmpty()) { ImportStatements importStatements = ImportStatements.create(compilationUnit, importOrganizer); importStatements.addAll(importsToAdd); diff --git a/check_api/src/main/java/com/google/errorprone/apply/Diff.java b/check_api/src/main/java/com/google/errorprone/apply/Diff.java index 5e469350ea4..56b287d6891 100644 --- a/check_api/src/main/java/com/google/errorprone/apply/Diff.java +++ b/check_api/src/main/java/com/google/errorprone/apply/Diff.java @@ -25,10 +25,6 @@ public interface Diff { /** Gets the name of the file this difference applies to */ String getRelevantFileName(); - /** - * Applies this difference to the supplied {@code sourceFile}. - * - * @throws DiffNotApplicableException if the diff could not be applied to the source file - */ + /** Applies this difference to the supplied {@code sourceFile}. */ void applyDifferences(SourceFile sourceFile); } diff --git a/check_api/src/main/java/com/google/errorprone/apply/DiffApplier.java b/check_api/src/main/java/com/google/errorprone/apply/DiffApplier.java index 386d79d1875..525a07d7a81 100644 --- a/check_api/src/main/java/com/google/errorprone/apply/DiffApplier.java +++ b/check_api/src/main/java/com/google/errorprone/apply/DiffApplier.java @@ -123,7 +123,7 @@ public void run() { if (completed % 100 == 0) { logger.log(Level.INFO, String.format("Completed %d files in %s", completed, stopwatch)); } - } catch (IOException | DiffNotApplicableException e) { + } catch (IOException | RuntimeException e) { logger.log(Level.WARNING, "Failed to apply diff to file " + diff.getRelevantFileName(), e); diffsFailedPaths.add(diff.getRelevantFileName()); } finally { diff --git a/check_api/src/main/java/com/google/errorprone/apply/DiffNotApplicableException.java b/check_api/src/main/java/com/google/errorprone/apply/DiffNotApplicableException.java deleted file mode 100644 index b4ef8ad600c..00000000000 --- a/check_api/src/main/java/com/google/errorprone/apply/DiffNotApplicableException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2011 The Error Prone Authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.errorprone.apply; - -/** Exception thrown if a {@link Diff} could not be applied by a {@link DiffApplier} */ -public class DiffNotApplicableException extends RuntimeException { - public DiffNotApplicableException(String msg) { - super(msg); - } - - public DiffNotApplicableException(String msg, Throwable cause) { - super(msg, cause); - } - - public DiffNotApplicableException(Throwable cause) { - super(cause); - } -}