From 11d2942f9cf7ccbf7650be24946f7b067e22d372 Mon Sep 17 00:00:00 2001 From: Scott Leberknight <174812+sleberknight@users.noreply.github.com> Date: Sat, 10 Aug 2024 19:47:34 -0400 Subject: [PATCH] Replace default clause in switch with exhaustive case label (#1190) Since we know the Level enum can only contain specific values, replace the default in the switch statement with a "case TRACE" arm. --- src/main/java/org/kiwiproject/retry/RetryLogger.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/org/kiwiproject/retry/RetryLogger.java b/src/main/java/org/kiwiproject/retry/RetryLogger.java index 12f52456..46b91c31 100644 --- a/src/main/java/org/kiwiproject/retry/RetryLogger.java +++ b/src/main/java/org/kiwiproject/retry/RetryLogger.java @@ -57,10 +57,7 @@ static void logAttempt(Logger logger, Level level, String message, Object... arg case INFO -> logger.info(message, args); case WARN -> logger.warn(message, args); case ERROR -> logger.error(message, args); - default -> - // NOTE: Intentional fall-through from TRACE. Whenever move to JDK 14+ can use enhanced switch - // when we won't need default since we'll be exhaustive on all Level values - logger.trace(message, args); + case TRACE -> logger.trace(message, args); } } }