Skip to content

Commit

Permalink
Adds Spotbugs suppression
Browse files Browse the repository at this point in the history
  • Loading branch information
jqno committed Jan 20, 2025
1 parent 7a88708 commit 1ad98e3
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.function.Function;

import nl.jqno.equalsverifier.internal.SuppressFBWarnings;
import nl.jqno.equalsverifier.internal.exceptions.EqualsVerifierInternalBugException;
import nl.jqno.equalsverifier.internal.exceptions.ModuleException;
import nl.jqno.equalsverifier.internal.exceptions.ReflectionException;
Expand Down Expand Up @@ -29,6 +30,9 @@ public final class Rethrow {
/** Do not instantiate. */
private Rethrow() {}

@SuppressFBWarnings(
value = "THROWS_METHOD_THROWS_RUNTIMEEXCEPTION",
justification = "Some runtime exceptions need to be re-thrown")
public static <T> T rethrow(ThrowingSupplier<T> supplier, Function<Throwable, String> errorMessage) {
try {
return supplier.get();
Expand Down Expand Up @@ -67,11 +71,17 @@ public static void rethrow(ThrowingRunnable block) {
}

@FunctionalInterface
@SuppressFBWarnings(
value = "THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION",
justification = "The point of this class is to handle these exceptions, so we have to be able to throw them too")
public interface ThrowingSupplier<T> {
T get() throws Exception;
}

@FunctionalInterface
@SuppressFBWarnings(
value = "THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION",
justification = "The point of this class is to handle these exceptions, so we have to be able to throw them too")
public interface ThrowingRunnable {
void run() throws Exception;
}
Expand Down

0 comments on commit 1ad98e3

Please sign in to comment.