Skip to content

Commit 8db1340

Browse files
committed
Merge branch '6.2.x'
2 parents 2f8c5a5 + 208d52d commit 8db1340

File tree

97 files changed

+378
-402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+378
-402
lines changed

Diff for: spring-aop/src/main/java/org/springframework/aop/config/AspectEntry.java

+3-3
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-2025 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.
@@ -46,8 +46,8 @@ public AspectEntry(String id, String ref) {
4646

4747
@Override
4848
public String toString() {
49-
return "Aspect: " + (StringUtils.hasLength(this.id) ? "id='" + this.id + "'"
50-
: "ref='" + this.ref + "'");
49+
return "Aspect: " + (StringUtils.hasLength(this.id) ? "id='" + this.id + "'" :
50+
"ref='" + this.ref + "'");
5151
}
5252

5353
}

Diff for: spring-aop/src/main/java/org/springframework/aop/support/ClassFilters.java

+3-3
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-2025 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.
@@ -199,8 +199,8 @@ public boolean matches(Class<?> clazz) {
199199

200200
@Override
201201
public boolean equals(Object other) {
202-
return (this == other || (other instanceof NegateClassFilter that
203-
&& this.original.equals(that.original)));
202+
return (this == other || (other instanceof NegateClassFilter that &&
203+
this.original.equals(that.original)));
204204
}
205205

206206
@Override

Diff for: spring-aop/src/main/java/org/springframework/aop/support/MethodMatchers.java

+3-3
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-2025 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.
@@ -379,8 +379,8 @@ public boolean matches(Method method, Class<?> targetClass, @Nullable Object...
379379

380380
@Override
381381
public boolean equals(Object other) {
382-
return (this == other || (other instanceof NegateMethodMatcher that
383-
&& this.original.equals(that.original)));
382+
return (this == other || (other instanceof NegateMethodMatcher that &&
383+
this.original.equals(that.original)));
384384
}
385385

386386
@Override

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/aot/AotServices.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2025 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.
@@ -211,9 +211,9 @@ public <T> AotServices<T> load(Class<T> type) {
211211
}
212212

213213
private <T> Map<String, T> loadBeans(Class<T> type) {
214-
return (this.beanFactory != null) ? BeanFactoryUtils
215-
.beansOfTypeIncludingAncestors(this.beanFactory, type, true, false)
216-
: Collections.emptyMap();
214+
return (this.beanFactory != null ?
215+
BeanFactoryUtils.beansOfTypeIncludingAncestors(this.beanFactory, type, true, false) :
216+
Collections.emptyMap());
217217
}
218218

219219
}

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanDefinitionMethodGeneratorFactory.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ class BeanDefinitionMethodGeneratorFactory {
6969
this.excludeFilters = loader.load(BeanRegistrationExcludeFilter.class);
7070
for (BeanRegistrationExcludeFilter excludeFilter : this.excludeFilters) {
7171
if (this.excludeFilters.getSource(excludeFilter) == Source.BEAN_FACTORY) {
72-
Assert.state(excludeFilter instanceof BeanRegistrationAotProcessor
73-
|| excludeFilter instanceof BeanFactoryInitializationAotProcessor,
72+
Assert.state(excludeFilter instanceof BeanRegistrationAotProcessor ||
73+
excludeFilter instanceof BeanFactoryInitializationAotProcessor,
7474
() -> "BeanRegistrationExcludeFilter bean of type %s must also implement an AOT processor interface"
7575
.formatted(excludeFilter.getClass().getName()));
7676
}

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/aot/InstanceSupplierCodeGenerator.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,7 @@ private void buildGetInstanceMethodForConstructor(MethodSpec.Builder method, Con
233233

234234
CodeBlock arguments = hasArguments ?
235235
new AutowiredArgumentsCodeGenerator(actualType, constructor)
236-
.generateCode(constructor.getParameterTypes(), (onInnerClass ? 1 : 0))
237-
: NO_ARGS;
236+
.generateCode(constructor.getParameterTypes(), (onInnerClass ? 1 : 0)) : NO_ARGS;
238237

239238
CodeBlock newInstance = generateNewInstanceCodeForConstructor(actualType, arguments);
240239
code.add(generateWithGeneratorCode(hasArguments, newInstance));
@@ -324,8 +323,7 @@ private void buildGetInstanceMethodForFactoryMethod(MethodSpec.Builder method,
324323
boolean hasArguments = factoryMethod.getParameterCount() > 0;
325324
CodeBlock arguments = hasArguments ?
326325
new AutowiredArgumentsCodeGenerator(ClassUtils.getUserClass(targetClass), factoryMethod)
327-
.generateCode(factoryMethod.getParameterTypes())
328-
: NO_ARGS;
326+
.generateCode(factoryMethod.getParameterTypes()) : NO_ARGS;
329327

330328
CodeBlock newInstance = generateNewInstanceCodeForMethod(
331329
factoryBeanName, ClassUtils.getUserClass(targetClass), factoryMethodName, arguments);

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractBeanDefinitionParser.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ public abstract class AbstractBeanDefinitionParser implements BeanDefinitionPars
6666
String id = resolveId(element, definition, parserContext);
6767
if (!StringUtils.hasText(id)) {
6868
parserContext.getReaderContext().error(
69-
"Id is required for element '" + parserContext.getDelegate().getLocalName(element)
70-
+ "' when used as a top-level tag", element);
69+
"Id is required for element '" + parserContext.getDelegate().getLocalName(element) +
70+
"' when used as a top-level tag", element);
7171
}
7272
String[] aliases = null;
7373
if (shouldParseNameAsAliases()) {

Diff for: spring-beans/src/test/java/org/springframework/beans/factory/annotation/ParameterResolutionTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ void annotatedParametersInInnerClassConstructorAreCandidatesForAutowiring() thro
7171
}
7272

7373
private void assertAutowirableParameters(Executable executable) {
74-
int startIndex = (executable instanceof Constructor)
75-
&& ClassUtils.isInnerClass(executable.getDeclaringClass()) ? 1 : 0;
74+
int startIndex = (executable instanceof Constructor) &&
75+
ClassUtils.isInnerClass(executable.getDeclaringClass()) ? 1 : 0;
7676
Parameter[] parameters = executable.getParameters();
7777
for (int parameterIndex = startIndex; parameterIndex < parameters.length; parameterIndex++) {
7878
Parameter parameter = parameters[parameterIndex];

Diff for: spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanInstanceSupplierTests.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ void forConstructorWhenNotFoundThrowsException() {
102102
RegisteredBean registerBean = source.registerBean(this.beanFactory);
103103
assertThatIllegalArgumentException()
104104
.isThrownBy(() -> resolver.get(registerBean)).withMessage(
105-
"Constructor with parameter types [java.io.InputStream] cannot be found on "
106-
+ SingleArgConstructor.class.getName());
105+
"Constructor with parameter types [java.io.InputStream] cannot be found on " +
106+
SingleArgConstructor.class.getName());
107107
}
108108

109109
@Test
@@ -150,8 +150,8 @@ void forFactoryMethodWhenNotFoundThrowsException() {
150150
RegisteredBean registerBean = source.registerBean(this.beanFactory);
151151
assertThatIllegalArgumentException()
152152
.isThrownBy(() -> resolver.get(registerBean)).withMessage(
153-
"Factory method 'single' with parameter types [java.io.InputStream] declared on class "
154-
+ SingleArgFactory.class.getName() + " cannot be found");
153+
"Factory method 'single' with parameter types [java.io.InputStream] declared on class " +
154+
SingleArgFactory.class.getName() + " cannot be found");
155155
}
156156

157157
@Test

Diff for: spring-beans/src/test/java/org/springframework/beans/factory/aot/DefaultBeanRegistrationCodeFragmentsTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ public void getTargetWithInstanceSupplierAndResourceDescription() {
8686
BeanRegistrationCodeFragments codeFragments = createInstance(registeredBean);
8787
assertThatExceptionOfType(AotBeanProcessingException.class)
8888
.isThrownBy(() -> codeFragments.getTarget(registeredBean))
89-
.withMessageContaining("Error processing bean with name 'testBean' defined in my test resource: "
90-
+ "instance supplier is not supported");
89+
.withMessageContaining("Error processing bean with name 'testBean' defined in my test resource: " +
90+
"instance supplier is not supported");
9191
}
9292

9393
@Test

Diff for: spring-context-indexer/src/main/java/org/springframework/context/index/processor/MetadataCollector.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ public CandidateComponentsMetadata getMetadata() {
9393

9494
private boolean shouldBeMerged(ItemMetadata itemMetadata) {
9595
String sourceType = itemMetadata.getType();
96-
return (sourceType != null && !deletedInCurrentBuild(sourceType)
97-
&& !processedInCurrentBuild(sourceType));
96+
return (sourceType != null && !deletedInCurrentBuild(sourceType) &&
97+
!processedInCurrentBuild(sourceType));
9898
}
9999

100100
private boolean deletedInCurrentBuild(String sourceType) {

Diff for: spring-context-indexer/src/test/java/org/springframework/context/index/processor/Metadata.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public static Condition<CandidateComponentsMetadata> of(String type,
4242
ItemMetadata itemMetadata = metadata.getItems().stream()
4343
.filter(item -> item.getType().equals(type))
4444
.findFirst().orElse(null);
45-
return itemMetadata != null && itemMetadata.getStereotypes().size() == stereotypes.size()
46-
&& itemMetadata.getStereotypes().containsAll(stereotypes);
45+
return (itemMetadata != null && itemMetadata.getStereotypes().size() == stereotypes.size() &&
46+
itemMetadata.getStereotypes().containsAll(stereotypes));
4747
}, "Candidates with type %s and stereotypes %s", type, stereotypes);
4848
}
4949

Diff for: spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AbstractJCacheKeyOperation.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ public CacheInvocationParameter[] getKeyParameters(@Nullable Object... values) {
8181
for (CacheParameterDetail keyParameterDetail : this.keyParameterDetails) {
8282
int parameterPosition = keyParameterDetail.getParameterPosition();
8383
if (parameterPosition >= values.length) {
84-
throw new IllegalStateException("Values mismatch, key parameter at position "
85-
+ parameterPosition + " cannot be matched against " + values.length + " value(s)");
84+
throw new IllegalStateException("Values mismatch, key parameter at position " +
85+
parameterPosition + " cannot be matched against " + values.length + " value(s)");
8686
}
8787
result.add(keyParameterDetail.toCacheInvocationParameter(values[parameterPosition]));
8888
}

Diff for: spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/JCacheKeyGeneratorTests.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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.
@@ -17,7 +17,6 @@
1717
package org.springframework.cache.jcache.interceptor;
1818

1919
import java.lang.reflect.Method;
20-
import java.util.Arrays;
2120
import java.util.concurrent.atomic.AtomicLong;
2221

2322
import javax.cache.annotation.CacheDefaults;
@@ -150,9 +149,9 @@ private void expect(Object... params) {
150149

151150
@Override
152151
public Object generate(Object target, Method method, Object... params) {
153-
assertThat(Arrays.equals(expectedParams, params)).as("Unexpected parameters: expected: "
154-
+ Arrays.toString(this.expectedParams) + " but got: " + Arrays.toString(params)).isTrue();
152+
assertThat(params).as("Unexpected parameters").isEqualTo(expectedParams);
155153
return new SimpleKey(params);
156154
}
157155
}
156+
158157
}

Diff for: spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ public void afterSingletonsInstantiated() {
282282
}
283283
}
284284
catch (NoSuchBeanDefinitionException ex) {
285-
throw new NoSuchBeanDefinitionException(CacheManager.class, "no CacheResolver specified - "
286-
+ "register a CacheManager bean or remove the @EnableCaching annotation from your configuration.");
285+
throw new NoSuchBeanDefinitionException(CacheManager.class, "no CacheResolver specified - " +
286+
"register a CacheManager bean or remove the @EnableCaching annotation from your configuration.");
287287
}
288288
}
289289
this.initialized = true;

Diff for: spring-context/src/main/java/org/springframework/cache/interceptor/NameMatchCacheOperationSource.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ public void addCacheMethod(String methodName, Collection<CacheOperation> ops) {
8484
// Look for most specific name match.
8585
String bestNameMatch = null;
8686
for (String mappedName : this.nameMap.keySet()) {
87-
if (isMatch(methodName, mappedName)
88-
&& (bestNameMatch == null || bestNameMatch.length() <= mappedName.length())) {
87+
if (isMatch(methodName, mappedName) &&
88+
(bestNameMatch == null || bestNameMatch.length() <= mappedName.length())) {
8989
ops = this.nameMap.get(mappedName);
9090
bestNameMatch = mappedName;
9191
}

Diff for: spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ class ConfigurationClassParser {
107107
(className.startsWith("java.lang.annotation.") || className.startsWith("org.springframework.stereotype."));
108108

109109
private static final Predicate<Condition> REGISTER_BEAN_CONDITION_FILTER = condition ->
110-
(condition instanceof ConfigurationCondition configurationCondition
111-
&& ConfigurationPhase.REGISTER_BEAN.equals(configurationCondition.getConfigurationPhase()));
110+
(condition instanceof ConfigurationCondition configurationCondition &&
111+
ConfigurationPhase.REGISTER_BEAN.equals(configurationCondition.getConfigurationPhase()));
112112

113113
private static final Comparator<DeferredImportSelectorHolder> DEFERRED_IMPORT_COMPARATOR =
114114
(o1, o2) -> AnnotationAwareOrderComparator.INSTANCE.compare(o1.getImportSelector(), o2.getImportSelector());

Diff for: spring-context/src/main/java/org/springframework/context/aot/ApplicationContextInitializationCodeGenerator.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,13 @@ private static class InitializerMethodArgumentCodeGenerator implements Function<
150150

151151
private @Nullable CodeBlock apply(ClassName className) {
152152
String name = className.canonicalName();
153-
if (name.equals(DefaultListableBeanFactory.class.getName())
154-
|| name.equals(ListableBeanFactory.class.getName())
155-
|| name.equals(ConfigurableListableBeanFactory.class.getName())) {
153+
if (name.equals(DefaultListableBeanFactory.class.getName()) ||
154+
name.equals(ListableBeanFactory.class.getName()) ||
155+
name.equals(ConfigurableListableBeanFactory.class.getName())) {
156156
return CodeBlock.of(BEAN_FACTORY_VARIABLE);
157157
}
158-
else if (name.equals(ConfigurableEnvironment.class.getName())
159-
|| name.equals(Environment.class.getName())) {
158+
else if (name.equals(ConfigurableEnvironment.class.getName()) ||
159+
name.equals(Environment.class.getName())) {
160160
return CodeBlock.of("$L.getEnvironment()", APPLICATION_CONTEXT_VARIABLE);
161161
}
162162
else if (name.equals(ResourceLoader.class.getName())) {

Diff for: spring-context/src/main/java/org/springframework/context/expression/StandardBeanExpressionResolver.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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.
@@ -201,8 +201,8 @@ private static int retrieveMaxExpressionLength() {
201201

202202
try {
203203
int maxLength = Integer.parseInt(value.trim());
204-
Assert.isTrue(maxLength > 0, () -> "Value [" + maxLength + "] for system property ["
205-
+ MAX_SPEL_EXPRESSION_LENGTH_PROPERTY_NAME + "] must be positive");
204+
Assert.isTrue(maxLength > 0, () -> "Value [" + maxLength + "] for system property [" +
205+
MAX_SPEL_EXPRESSION_LENGTH_PROPERTY_NAME + "] must be positive");
206206
return maxLength;
207207
}
208208
catch (NumberFormatException ex) {

Diff for: spring-context/src/main/java/org/springframework/context/support/PostProcessorRegistrationDelegate.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -493,8 +493,8 @@ private void postProcessRootBeanDefinition(List<MergedBeanDefinitionPostProcesso
493493

494494
private void postProcessValue(List<MergedBeanDefinitionPostProcessor> postProcessors,
495495
BeanDefinitionValueResolver valueResolver, @Nullable Object value) {
496-
if (value instanceof BeanDefinitionHolder bdh
497-
&& bdh.getBeanDefinition() instanceof AbstractBeanDefinition innerBd) {
496+
if (value instanceof BeanDefinitionHolder bdh &&
497+
bdh.getBeanDefinition() instanceof AbstractBeanDefinition innerBd) {
498498

499499
Class<?> innerBeanType = resolveBeanType(innerBd);
500500
resolveInnerBeanDefinition(valueResolver, innerBd, (innerBeanName, innerBeanDefinition)

Diff for: spring-context/src/main/java/org/springframework/format/datetime/standard/DurationFormatterUtils.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ public static DurationFormat.Style detect(String value) {
144144

145145
private static final Pattern ISO_8601_PATTERN = Pattern.compile("^[+-]?[pP].*$");
146146
private static final Pattern SIMPLE_PATTERN = Pattern.compile("^([+-]?\\d+)([a-zA-Z]{0,2})$");
147-
private static final Pattern COMPOSITE_PATTERN = Pattern.compile("^([+-]?)\\(?\\s?(\\d+d)?\\s?(\\d+h)?\\s?(\\d+m)?"
148-
+ "\\s?(\\d+s)?\\s?(\\d+ms)?\\s?(\\d+us)?\\s?(\\d+ns)?\\)?$");
147+
private static final Pattern COMPOSITE_PATTERN = Pattern.compile("^([+-]?)\\(?\\s?(\\d+d)?\\s?(\\d+h)?\\s?(\\d+m)?" +
148+
"\\s?(\\d+s)?\\s?(\\d+ms)?\\s?(\\d+us)?\\s?(\\d+ns)?\\)?$");
149149

150150
private static Duration parseIso8601(String value) {
151151
try {

Diff for: spring-context/src/main/java/org/springframework/scheduling/support/DefaultScheduledTaskObservationConvention.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public String getName() {
4848

4949
@Override
5050
public String getContextualName(ScheduledTaskObservationContext context) {
51-
return "task " + StringUtils.uncapitalize(context.getTargetClass().getSimpleName())
52-
+ "." + context.getMethod().getName();
51+
return "task " + StringUtils.uncapitalize(context.getTargetClass().getSimpleName()) +
52+
"." + context.getMethod().getName();
5353
}
5454

5555
@Override

Diff for: spring-context/src/test/java/org/springframework/aop/aspectj/AspectAndAdvicePrecedenceTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ private static class PrecedenceVerifyingCollaborator implements PrecedenceTestAs
106106
private void checkAdvice(String whatJustHappened) {
107107
//System.out.println("[" + adviceInvocationNumber + "] " + whatJustHappened + " ==> " + EXPECTED[adviceInvocationNumber]);
108108
if (adviceInvocationNumber > (EXPECTED.length - 1)) {
109-
throw new AssertionError("Too many advice invocations, expecting " + EXPECTED.length
110-
+ " but had " + adviceInvocationNumber);
109+
throw new AssertionError("Too many advice invocations, expecting " + EXPECTED.length +
110+
" but had " + adviceInvocationNumber);
111111
}
112112
String expecting = EXPECTED[adviceInvocationNumber++];
113113
if (!whatJustHappened.equals(expecting)) {

0 commit comments

Comments
 (0)