diff --git a/cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java b/cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java index 39f1b6c5976..643f47fcce0 100644 --- a/cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java +++ b/cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java @@ -244,7 +244,7 @@ public class CommandRunner implements Iterable { if (ex instanceof CommandException commandException) { options = commandException.getOptions(); if (options.contains(CommandException.Option.RETHROW)) { - throw (CommandException) ex; + throw commandException; } } boolean couldNotShowMessage = false; diff --git a/core/spring-boot-test/src/main/java/org/springframework/boot/test/context/AnnotationsPropertySource.java b/core/spring-boot-test/src/main/java/org/springframework/boot/test/context/AnnotationsPropertySource.java index b5c320e1b55..68133a41268 100644 --- a/core/spring-boot-test/src/main/java/org/springframework/boot/test/context/AnnotationsPropertySource.java +++ b/core/spring-boot-test/src/main/java/org/springframework/boot/test/context/AnnotationsPropertySource.java @@ -138,7 +138,7 @@ class AnnotationsPropertySource extends EnumerablePropertySource> { } else if (value instanceof MergedAnnotation annotation) { for (Method attribute : annotation.getType().getDeclaredMethods()) { - collectProperties(name, defaultSkip, (MergedAnnotation) value, attribute, properties); + collectProperties(name, defaultSkip, annotation, attribute, properties); } } else {