Upgrade error-prone to 3.3.4 (#848)

* Upgrade error-prone to 3.3.4

This would fix the failure with openjdk 11.0.9 in
3.3.3.

Fixed new antipatterns raised by the new version:
- Replaced unnecessary lambdas with methods.
- Switched wait/sleep calls to equivalent methods using java.time types
- Types inheriting Object.toString() should not be assigned to string
parameter in logging statements.
This commit is contained in:
Weimin Yu 2020-10-23 11:17:57 -04:00 committed by GitHub
parent 96cb9abcf3
commit 9ddde4799c
53 changed files with 495 additions and 358 deletions

View file

@ -71,7 +71,7 @@ public class Retrier implements Serializable {
* @return the value returned by the {@link Callable}.
*/
public <V> V callWithRetry(Callable<V> callable, Predicate<Throwable> isRetryable) {
return callWithRetry(callable, LOGGING_FAILURE_REPORTER, isRetryable);
return callWithRetry(callable, Retrier::reportFailure, isRetryable);
}
/**
@ -92,7 +92,7 @@ public class Retrier implements Serializable {
Callable<V> callable,
Class<? extends Throwable> retryableError,
Class<? extends Throwable>... moreRetryableErrors) {
return callWithRetry(callable, LOGGING_FAILURE_REPORTER, retryableError, moreRetryableErrors);
return callWithRetry(callable, Retrier::reportFailure, retryableError, moreRetryableErrors);
}
/**
@ -171,8 +171,8 @@ public class Retrier implements Serializable {
}
}
private static final FailureReporter LOGGING_FAILURE_REPORTER =
(thrown, failures, maxAttempts) ->
logger.atInfo().withCause(thrown).log(
"Retrying transient error, attempt %d/%d", failures, maxAttempts);
private static void reportFailure(Throwable thrown, int failures, int maxAttempts) {
logger.atInfo().withCause(thrown).log(
"Retrying transient error, attempt %d/%d", failures, maxAttempts);
}
}