Skip to content

Commit

Permalink
Define our own ProvisionException
Browse files Browse the repository at this point in the history
to simplify dependency requirements for OSS.

#3897

PiperOrigin-RevId: 535265714
  • Loading branch information
cushon authored and Error Prone Team committed May 25, 2023
1 parent c27ceac commit f2f1051
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.google.common.collect.MutableClassToInstanceMap;
import com.google.errorprone.ErrorProneFlags;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.inject.ProvisionException;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -41,6 +40,17 @@
public final class ErrorProneInjector {
private final ClassToInstanceMap<Object> instances = MutableClassToInstanceMap.create();

/** Indicates that there was a runtime failure while providing an instance. */
public static final class ProvisionException extends RuntimeException {
public ProvisionException(String message) {
super(message);
}

public ProvisionException(String message, Throwable cause) {
super(message, cause);
}
}

public static ErrorProneInjector create() {
return new ErrorProneInjector();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertThrows;

import com.google.inject.ProvisionException;
import com.google.errorprone.scanner.ErrorProneInjector.ProvisionException;
import javax.inject.Inject;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down

0 comments on commit f2f1051

Please sign in to comment.