Skip to content

Commit b5377ee

Browse files
committed
Polishing
1 parent eff1ca9 commit b5377ee

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -121,16 +121,16 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
121121
implements ConfigurableListableBeanFactory, BeanDefinitionRegistry, Serializable {
122122

123123
@Nullable
124-
private static Class<?> javaxInjectProviderClass;
124+
private static Class<?> jakartaInjectProviderClass;
125125

126126
static {
127127
try {
128-
javaxInjectProviderClass =
128+
jakartaInjectProviderClass =
129129
ClassUtils.forName("jakarta.inject.Provider", DefaultListableBeanFactory.class.getClassLoader());
130130
}
131131
catch (ClassNotFoundException ex) {
132132
// JSR-330 API not available - Provider interface simply not supported then.
133-
javaxInjectProviderClass = null;
133+
jakartaInjectProviderClass = null;
134134
}
135135
}
136136

@@ -1327,7 +1327,7 @@ else if (ObjectFactory.class == descriptor.getDependencyType() ||
13271327
ObjectProvider.class == descriptor.getDependencyType()) {
13281328
return new DependencyObjectProvider(descriptor, requestingBeanName);
13291329
}
1330-
else if (javaxInjectProviderClass == descriptor.getDependencyType()) {
1330+
else if (jakartaInjectProviderClass == descriptor.getDependencyType()) {
13311331
return new Jsr330Factory().createDependencyProvider(descriptor, requestingBeanName);
13321332
}
13331333
else {
@@ -1757,7 +1757,7 @@ else if (candidatePriority < highestPriority) {
17571757
* Return whether the bean definition for the given bean name has been
17581758
* marked as a primary bean.
17591759
* @param beanName the name of the bean
1760-
* @param beanInstance the corresponding bean instance (can be null)
1760+
* @param beanInstance the corresponding bean instance (can be {@code null})
17611761
* @return whether the given bean qualifies as primary
17621762
*/
17631763
protected boolean isPrimary(String beanName, Object beanInstance) {

Diff for: spring-core/src/main/java/org/springframework/aot/hint/BindingReflectionHintsRegistrar.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -40,7 +40,7 @@
4040

4141
/**
4242
* Register the necessary reflection hints so that the specified type can be
43-
* bound at runtime. Fields, constructors, properties and record components
43+
* bound at runtime. Fields, constructors, properties, and record components
4444
* are registered, except for a set of types like those in the {@code java.}
4545
* package where just the type is registered. Types are discovered transitively
4646
* on properties and record components, and generic types are registered as well.
@@ -54,8 +54,9 @@ public class BindingReflectionHintsRegistrar {
5454

5555
private static final String JACKSON_ANNOTATION = "com.fasterxml.jackson.annotation.JacksonAnnotation";
5656

57-
private static final boolean jacksonAnnotationPresent = ClassUtils.isPresent(JACKSON_ANNOTATION,
58-
BindingReflectionHintsRegistrar.class.getClassLoader());
57+
private static final boolean jacksonAnnotationPresent =
58+
ClassUtils.isPresent(JACKSON_ANNOTATION, BindingReflectionHintsRegistrar.class.getClassLoader());
59+
5960

6061
/**
6162
* Register the necessary reflection hints to bind the specified types.
@@ -94,8 +95,7 @@ private void registerReflectionHints(ReflectionHints hints, Set<Type> seen, Type
9495
registerRecordHints(hints, seen, recordComponent.getAccessor());
9596
}
9697
}
97-
typeHint.withMembers(
98-
MemberCategory.DECLARED_FIELDS,
98+
typeHint.withMembers(MemberCategory.DECLARED_FIELDS,
9999
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
100100
for (Method method : clazz.getMethods()) {
101101
String methodName = method.getName();
@@ -132,8 +132,7 @@ private void registerRecordHints(ReflectionHints hints, Set<Type> seen, Method m
132132
}
133133

134134
private void registerPropertyHints(ReflectionHints hints, Set<Type> seen, @Nullable Method method, int parameterIndex) {
135-
if (method != null && method.getDeclaringClass() != Object.class &&
136-
method.getDeclaringClass() != Enum.class) {
135+
if (method != null && method.getDeclaringClass() != Object.class && method.getDeclaringClass() != Enum.class) {
137136
hints.registerMethod(method, ExecutableMode.INVOKE);
138137
MethodParameter methodParameter = MethodParameter.forExecutable(method, parameterIndex);
139138
Type methodParameterType = methodParameter.getGenericParameterType();
@@ -191,13 +190,13 @@ private void forEachJacksonAnnotation(AnnotatedElement element, Consumer<MergedA
191190
.from(element, MergedAnnotations.SearchStrategy.TYPE_HIERARCHY)
192191
.stream(JACKSON_ANNOTATION)
193192
.filter(MergedAnnotation::isMetaPresent)
194-
.forEach(action::accept);
193+
.forEach(action);
195194
}
196195

197196
private void registerHintsForClassAttributes(ReflectionHints hints, MergedAnnotation<Annotation> annotation) {
198-
annotation.getRoot().asMap().forEach((key,value) -> {
197+
annotation.getRoot().asMap().forEach((attributeName, value) -> {
199198
if (value instanceof Class<?> classValue && value != Void.class) {
200-
if (key.equals("builder")) {
199+
if (attributeName.equals("builder")) {
201200
hints.registerType(classValue, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
202201
MemberCategory.INVOKE_DECLARED_METHODS);
203202
}
@@ -208,6 +207,7 @@ private void registerHintsForClassAttributes(ReflectionHints hints, MergedAnnota
208207
});
209208
}
210209

210+
211211
/**
212212
* Inner class to avoid a hard dependency on Kotlin at runtime.
213213
*/

Diff for: spring-web/src/main/java/org/springframework/http/CacheControl.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -393,7 +393,7 @@ private String toHeaderValue() {
393393
}
394394

395395
private void appendDirective(StringBuilder builder, String value) {
396-
if (builder.length() > 0) {
396+
if (!builder.isEmpty()) {
397397
builder.append(", ");
398398
}
399399
builder.append(value);

0 commit comments

Comments
 (0)