Skip to content

Commit

Permalink
Replace default clause in switch with exhaustive case label (#1190)
Browse files Browse the repository at this point in the history
Since we know the Level enum can only contain specific values, replace
the default in the switch statement with a "case TRACE" arm.
  • Loading branch information
sleberknight authored Aug 10, 2024
1 parent c032012 commit 11d2942
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/main/java/org/kiwiproject/retry/RetryLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

0 comments on commit 11d2942

Please sign in to comment.