From 6b60d89b28b1fde311cd592da085dad9f4587b3a Mon Sep 17 00:00:00 2001 From: geopark021 Date: Wed, 26 Nov 2025 18:18:29 +0900 Subject: [PATCH] Remove unnecessary cast Replace explicit casts with pattern variables to improve readability and remove redundancy. See gh-48297 Signed-off-by: geopark021 --- .../autoconfigure/properties/AnnotationsPropertySource.java | 2 +- .../org/springframework/boot/cli/command/CommandRunner.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java index 6a67cc26620..ab4792df0f8 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java @@ -138,7 +138,7 @@ public 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 { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java b/spring-boot-project/spring-boot-tools/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java index 9ceb76ce4c5..732225ca87c 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java @@ -242,7 +242,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;