From 3c5d46166ebe8e980d22fa0a6bb919725bf5734a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Thu, 28 Dec 2023 13:30:02 +0100 Subject: [PATCH] Polish "Replace if with switch where feasible" See gh-31916 --- .../annotation/ComponentScanBeanDefinitionParser.java | 5 ++--- .../scheduling/config/ExecutorBeanDefinitionParser.java | 2 +- .../java/org/springframework/jdbc/support/JdbcUtils.java | 9 +++------ .../web/context/request/FacesRequestAttributes.java | 2 +- .../main/java/org/springframework/web/util/TagUtils.java | 2 +- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ComponentScanBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/context/annotation/ComponentScanBeanDefinitionParser.java index 321b8bb5b05..ef45f218b3f 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ComponentScanBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ComponentScanBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -186,8 +186,7 @@ public class ComponentScanBeanDefinitionParser implements BeanDefinitionParser { case "targetClass" -> scanner.setScopedProxyMode(ScopedProxyMode.TARGET_CLASS); case "interfaces" -> scanner.setScopedProxyMode(ScopedProxyMode.INTERFACES); case "no" -> scanner.setScopedProxyMode(ScopedProxyMode.NO); - default -> - throw new IllegalArgumentException("scoped-proxy only supports 'no', 'interfaces' and 'targetClass'"); + default -> throw new IllegalArgumentException("scoped-proxy only supports 'no', 'interfaces' and 'targetClass'"); } } } diff --git a/spring-context/src/main/java/org/springframework/scheduling/config/ExecutorBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/scheduling/config/ExecutorBeanDefinitionParser.java index 875ba05641e..1987aba7b9d 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/config/ExecutorBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/scheduling/config/ExecutorBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java index 3ab884013d6..3cedfe2bef6 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java @@ -246,13 +246,10 @@ public abstract class JdbcUtils { case "LocalDate" -> rs.getDate(index); case "LocalTime" -> rs.getTime(index); case "LocalDateTime" -> rs.getTimestamp(index); - default -> - - // Fall back to getObject without type specification, again - // left up to the caller to convert the value if necessary. - getResultSetValue(rs, index); + // Fall back to getObject without type specification, again + // left up to the caller to convert the value if necessary. + default -> getResultSetValue(rs, index); }; - } // Perform was-null check if necessary (for results that the JDBC driver returns as primitives). diff --git a/spring-web/src/main/java/org/springframework/web/context/request/FacesRequestAttributes.java b/spring-web/src/main/java/org/springframework/web/context/request/FacesRequestAttributes.java index f68599e6cf3..c936d89277c 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/FacesRequestAttributes.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/FacesRequestAttributes.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/util/TagUtils.java b/spring-web/src/main/java/org/springframework/web/util/TagUtils.java index 6f9eb3a930a..c62ff3adac5 100644 --- a/spring-web/src/main/java/org/springframework/web/util/TagUtils.java +++ b/spring-web/src/main/java/org/springframework/web/util/TagUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.