Browse Source

Remove unnecessary cast

Replace explicit casts with pattern variables to improve readability and
remove redundancy.

See gh-48297

Signed-off-by: geopark021 <geobrown021@gmail.com>
pull/48470/head
geopark021 2 months ago committed by Stéphane Nicoll
parent
commit
6b60d89b28
  1. 2
      spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java
  2. 2
      spring-boot-project/spring-boot-tools/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java

2
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<Class<?> @@ -138,7 +138,7 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>
}
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 {

2
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<Command> { @@ -242,7 +242,7 @@ public class CommandRunner implements Iterable<Command> {
if (ex instanceof CommandException commandException) {
options = commandException.getOptions();
if (options.contains(CommandException.Option.RETHROW)) {
throw (CommandException) ex;
throw commandException;
}
}
boolean couldNotShowMessage = false;

Loading…
Cancel
Save