From d0bff584d7a2b276cb76669662189a5938be055a Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 13 Aug 2024 18:51:02 +0200 Subject: [PATCH] Polishing --- .../aot/hint/BindingReflectionHintsRegistrar.java | 15 +++++++-------- .../org/springframework/http/CacheControl.java | 4 ++-- .../context/request/async/WebAsyncManager.java | 3 +-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/aot/hint/BindingReflectionHintsRegistrar.java b/spring-core/src/main/java/org/springframework/aot/hint/BindingReflectionHintsRegistrar.java index d4951f15141f..e4357496c163 100644 --- a/spring-core/src/main/java/org/springframework/aot/hint/BindingReflectionHintsRegistrar.java +++ b/spring-core/src/main/java/org/springframework/aot/hint/BindingReflectionHintsRegistrar.java @@ -54,8 +54,9 @@ public class BindingReflectionHintsRegistrar { private static final String JACKSON_ANNOTATION = "com.fasterxml.jackson.annotation.JacksonAnnotation"; - private static final boolean jacksonAnnotationPresent = ClassUtils.isPresent(JACKSON_ANNOTATION, - BindingReflectionHintsRegistrar.class.getClassLoader()); + private static final boolean jacksonAnnotationPresent = + ClassUtils.isPresent(JACKSON_ANNOTATION, BindingReflectionHintsRegistrar.class.getClassLoader()); + /** * Register the necessary reflection hints to bind the specified types. @@ -95,12 +96,10 @@ private void registerReflectionHints(ReflectionHints hints, Set seen, Type } } if (clazz.isEnum()) { - typeHint.withMembers( - MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS, + typeHint.withMembers(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS, MemberCategory.INVOKE_PUBLIC_METHODS); } - typeHint.withMembers( - MemberCategory.DECLARED_FIELDS, + typeHint.withMembers(MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS); for (Method method : clazz.getMethods()) { String methodName = method.getName(); @@ -137,8 +136,7 @@ private void registerRecordHints(ReflectionHints hints, Set seen, Method m } private void registerPropertyHints(ReflectionHints hints, Set seen, @Nullable Method method, int parameterIndex) { - if (method != null && method.getDeclaringClass() != Object.class && - method.getDeclaringClass() != Enum.class) { + if (method != null && method.getDeclaringClass() != Object.class && method.getDeclaringClass() != Enum.class) { hints.registerMethod(method, ExecutableMode.INVOKE); MethodParameter methodParameter = MethodParameter.forExecutable(method, parameterIndex); Type methodParameterType = methodParameter.getGenericParameterType(); @@ -213,6 +211,7 @@ private void registerHintsForClassAttributes(ReflectionHints hints, MergedAnnota }); } + /** * Inner class to avoid a hard dependency on Kotlin at runtime. */ diff --git a/spring-web/src/main/java/org/springframework/http/CacheControl.java b/spring-web/src/main/java/org/springframework/http/CacheControl.java index 4cb693cf8f91..00b32d8aa483 100644 --- a/spring-web/src/main/java/org/springframework/http/CacheControl.java +++ b/spring-web/src/main/java/org/springframework/http/CacheControl.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -393,7 +393,7 @@ private String toHeaderValue() { } private void appendDirective(StringBuilder builder, String value) { - if (builder.length() > 0) { + if (!builder.isEmpty()) { builder.append(", "); } builder.append(value); diff --git a/spring-web/src/main/java/org/springframework/web/context/request/async/WebAsyncManager.java b/spring-web/src/main/java/org/springframework/web/context/request/async/WebAsyncManager.java index 1cfdeead2f5e..d89ed4f35b17 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/async/WebAsyncManager.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/async/WebAsyncManager.java @@ -245,8 +245,7 @@ public void registerDeferredResultInterceptors(DeferredResultProcessingIntercept } /** - * Mark the {@link WebAsyncManager} as wrapping a - * multipart async request. + * Mark the {@link WebAsyncManager} as wrapping a multipart async request. * @since 6.1.12 */ public void setMultipartRequestParsed(boolean isMultipart) {