Skip to content

Commit 077146d

Browse files
committed
Merge branch '6.2.x'
2 parents b6a121e + 18d6a55 commit 077146d

File tree

36 files changed

+122
-130
lines changed

36 files changed

+122
-130
lines changed

spring-aop/src/testFixtures/java/org/springframework/aop/testfixture/advice/MethodCounter.java

Lines changed: 3 additions & 3 deletions
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.
@@ -24,7 +24,7 @@
2424
import org.jspecify.annotations.Nullable;
2525

2626
/**
27-
* Abstract superclass for counting advices etc.
27+
* Abstract superclass for counting advice, etc.
2828
*
2929
* @author Rod Johnson
3030
* @author Chris Beams
@@ -62,7 +62,7 @@ public int getCalls() {
6262
*/
6363
@Override
6464
public boolean equals(@Nullable Object other) {
65-
return (other != null && other.getClass() == this.getClass());
65+
return (other != null && getClass() == other.getClass());
6666
}
6767

6868
@Override

spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanLookupTests.java

Lines changed: 6 additions & 4 deletions
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.
@@ -33,13 +33,14 @@
3333
* @author Chris Beams
3434
*/
3535
class FactoryBeanLookupTests {
36-
private BeanFactory beanFactory;
36+
37+
private final BeanFactory beanFactory = new DefaultListableBeanFactory();
38+
3739

3840
@BeforeEach
3941
void setUp() {
40-
beanFactory = new DefaultListableBeanFactory();
4142
new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory).loadBeanDefinitions(
42-
new ClassPathResource("FactoryBeanLookupTests-context.xml", this.getClass()));
43+
new ClassPathResource("FactoryBeanLookupTests-context.xml", getClass()));
4344
}
4445

4546
@Test
@@ -71,6 +72,7 @@ void factoryBeanObjectLookupByNameAndType() {
7172
Foo foo = beanFactory.getBean("fooFactory", Foo.class);
7273
assertThat(foo).isNotNull();
7374
}
75+
7476
}
7577

7678
class FooFactoryBean extends AbstractFactoryBean<Foo> {

spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void localPropertiesViaResource() {
8484
.getBeanDefinition());
8585

8686
PropertyPlaceholderConfigurer pc = new PropertyPlaceholderConfigurer();
87-
Resource resource = new ClassPathResource("PropertyPlaceholderConfigurerTests.properties", this.getClass());
87+
Resource resource = new ClassPathResource("PropertyPlaceholderConfigurerTests.properties", getClass());
8888
pc.setLocation(resource);
8989
pc.postProcessBeanFactory(bf);
9090
}

spring-beans/src/test/java/org/springframework/beans/factory/xml/DuplicateBeanIdTests.java

Lines changed: 3 additions & 3 deletions
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.
@@ -46,15 +46,15 @@ void duplicateBeanIdsWithinSameNestingLevelRaisesError() {
4646
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
4747
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(bf);
4848
assertThatException().as("duplicate ids in same nesting level").isThrownBy(() ->
49-
reader.loadBeanDefinitions(new ClassPathResource("DuplicateBeanIdTests-sameLevel-context.xml", this.getClass())));
49+
reader.loadBeanDefinitions(new ClassPathResource("DuplicateBeanIdTests-sameLevel-context.xml", getClass())));
5050
}
5151

5252
@Test
5353
void duplicateBeanIdsAcrossNestingLevels() {
5454
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
5555
bf.setAllowBeanDefinitionOverriding(true);
5656
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(bf);
57-
reader.loadBeanDefinitions(new ClassPathResource("DuplicateBeanIdTests-multiLevel-context.xml", this.getClass()));
57+
reader.loadBeanDefinitions(new ClassPathResource("DuplicateBeanIdTests-multiLevel-context.xml", getClass()));
5858
TestBean testBean = bf.getBean(TestBean.class); // there should be only one
5959
assertThat(testBean.getName()).isEqualTo("nested");
6060
}

spring-beans/src/test/java/org/springframework/beans/factory/xml/NestedBeansElementAttributeRecursionTests.java

Lines changed: 8 additions & 8 deletions
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.
@@ -36,7 +36,7 @@ class NestedBeansElementAttributeRecursionTests {
3636
void defaultLazyInit() {
3737
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
3838
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
39-
new ClassPathResource("NestedBeansElementAttributeRecursionTests-lazy-context.xml", this.getClass()));
39+
new ClassPathResource("NestedBeansElementAttributeRecursionTests-lazy-context.xml", getClass()));
4040

4141
assertLazyInits(bf);
4242
}
@@ -47,7 +47,7 @@ void defaultLazyInitWithNonValidatingParser() {
4747
XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(bf);
4848
xmlBeanDefinitionReader.setValidating(false);
4949
xmlBeanDefinitionReader.loadBeanDefinitions(
50-
new ClassPathResource("NestedBeansElementAttributeRecursionTests-lazy-context.xml", this.getClass()));
50+
new ClassPathResource("NestedBeansElementAttributeRecursionTests-lazy-context.xml", getClass()));
5151

5252
assertLazyInits(bf);
5353
}
@@ -70,7 +70,7 @@ private void assertLazyInits(DefaultListableBeanFactory bf) {
7070
void defaultMerge() {
7171
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
7272
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
73-
new ClassPathResource("NestedBeansElementAttributeRecursionTests-merge-context.xml", this.getClass()));
73+
new ClassPathResource("NestedBeansElementAttributeRecursionTests-merge-context.xml", getClass()));
7474

7575
assertMerge(bf);
7676
}
@@ -81,7 +81,7 @@ void defaultMergeWithNonValidatingParser() {
8181
XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(bf);
8282
xmlBeanDefinitionReader.setValidating(false);
8383
xmlBeanDefinitionReader.loadBeanDefinitions(
84-
new ClassPathResource("NestedBeansElementAttributeRecursionTests-merge-context.xml", this.getClass()));
84+
new ClassPathResource("NestedBeansElementAttributeRecursionTests-merge-context.xml", getClass()));
8585

8686
assertMerge(bf);
8787
}
@@ -109,7 +109,7 @@ private void assertMerge(DefaultListableBeanFactory bf) {
109109
void defaultAutowireCandidates() {
110110
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
111111
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
112-
new ClassPathResource("NestedBeansElementAttributeRecursionTests-autowire-candidates-context.xml", this.getClass()));
112+
new ClassPathResource("NestedBeansElementAttributeRecursionTests-autowire-candidates-context.xml", getClass()));
113113

114114
assertAutowireCandidates(bf);
115115
}
@@ -120,7 +120,7 @@ void defaultAutowireCandidatesWithNonValidatingParser() {
120120
XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(bf);
121121
xmlBeanDefinitionReader.setValidating(false);
122122
xmlBeanDefinitionReader.loadBeanDefinitions(
123-
new ClassPathResource("NestedBeansElementAttributeRecursionTests-autowire-candidates-context.xml", this.getClass()));
123+
new ClassPathResource("NestedBeansElementAttributeRecursionTests-autowire-candidates-context.xml", getClass()));
124124

125125
assertAutowireCandidates(bf);
126126
}
@@ -149,7 +149,7 @@ private void assertAutowireCandidates(DefaultListableBeanFactory bf) {
149149
void initMethod() {
150150
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
151151
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
152-
new ClassPathResource("NestedBeansElementAttributeRecursionTests-init-destroy-context.xml", this.getClass()));
152+
new ClassPathResource("NestedBeansElementAttributeRecursionTests-init-destroy-context.xml", getClass()));
153153

154154
InitDestroyBean beanA = bf.getBean("beanA", InitDestroyBean.class);
155155
InitDestroyBean beanB = bf.getBean("beanB", InitDestroyBean.class);

spring-beans/src/test/java/org/springframework/beans/factory/xml/NestedBeansElementTests.java

Lines changed: 3 additions & 4 deletions
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.
@@ -26,15 +26,14 @@
2626

2727
import static org.assertj.core.api.Assertions.assertThat;
2828

29-
3029
/**
3130
* Tests for new nested beans element support in Spring XML
3231
*
3332
* @author Chris Beams
3433
*/
3534
class NestedBeansElementTests {
36-
private final Resource XML =
37-
new ClassPathResource("NestedBeansElementTests-context.xml", this.getClass());
35+
36+
private final Resource XML = new ClassPathResource("NestedBeansElementTests-context.xml", getClass());
3837

3938
@Test
4039
void getBean_withoutActiveProfile() {

spring-context/src/test/java/org/springframework/cache/interceptor/SimpleKeyGeneratorTests.java

Lines changed: 2 additions & 2 deletions
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.
@@ -130,7 +130,7 @@ void serializedKeys() throws Exception {
130130

131131

132132
private Object generateKey(Object[] arguments) {
133-
Method method = ReflectionUtils.findMethod(this.getClass(), "generateKey", Object[].class);
133+
Method method = ReflectionUtils.findMethod(getClass(), "generateKey", Object[].class);
134134
return this.generator.generate(this, method, arguments);
135135
}
136136

spring-context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ void localPropertiesViaResource() {
170170
.getBeanDefinition());
171171

172172
PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer();
173-
Resource resource = new ClassPathResource("PropertySourcesPlaceholderConfigurerTests.properties", this.getClass());
173+
Resource resource = new ClassPathResource("PropertySourcesPlaceholderConfigurerTests.properties", getClass());
174174
ppc.setLocation(resource);
175175
ppc.postProcessBeanFactory(bf);
176176
assertThat(bf.getBean(TestBean.class).getName()).isEqualTo("foo");

spring-core/src/main/java/org/springframework/aot/hint/AbstractTypeReference.java

Lines changed: 2 additions & 2 deletions
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.
@@ -79,7 +79,7 @@ protected String addPackageIfNecessary(String part) {
7979

8080
@Override
8181
public int compareTo(TypeReference other) {
82-
return this.getCanonicalName().compareToIgnoreCase(other.getCanonicalName());
82+
return getCanonicalName().compareToIgnoreCase(other.getCanonicalName());
8383
}
8484

8585
@Override

spring-core/src/main/java/org/springframework/core/env/AbstractPropertyResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public void setRequiredProperties(String... requiredProperties) {
192192
public void validateRequiredProperties() {
193193
MissingRequiredPropertiesException ex = new MissingRequiredPropertiesException();
194194
for (String key : this.requiredProperties) {
195-
if (this.getProperty(key) == null) {
195+
if (getProperty(key) == null) {
196196
ex.addMissingRequiredProperty(key);
197197
}
198198
}

spring-core/src/test/java/org/springframework/util/ClassUtilsTests.java

Lines changed: 2 additions & 2 deletions
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.
@@ -228,7 +228,7 @@ void getShortNameForNestedClass() {
228228

229229
@Test
230230
void getShortNameAsProperty() {
231-
String shortName = ClassUtils.getShortNameAsProperty(this.getClass());
231+
String shortName = ClassUtils.getShortNameAsProperty(getClass());
232232
assertThat(shortName).as("Class name did not match").isEqualTo("classUtilsTests");
233233
}
234234

spring-core/src/test/java/org/springframework/util/CollectionUtilsTests.java

Lines changed: 2 additions & 2 deletions
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.
@@ -383,7 +383,7 @@ public boolean equals(@Nullable Object rhs) {
383383
if (this == rhs) {
384384
return true;
385385
}
386-
if (rhs == null || this.getClass() != rhs.getClass()) {
386+
if (rhs == null || getClass() != rhs.getClass()) {
387387
return false;
388388
}
389389
Instance instance = (Instance) rhs;

spring-expression/src/test/java/org/springframework/expression/spel/VariableAndFunctionTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ void functionViaMethodHandleForStaticMethodThatAcceptsOnlyVarargs() {
276276

277277
@Test
278278
void functionMethodMustBeStatic() throws Exception {
279-
context.registerFunction("nonStatic", this.getClass().getMethod("nonStatic"));
279+
context.registerFunction("nonStatic", getClass().getMethod("nonStatic"));
280280
SpelExpression expression = parser.parseRaw("#nonStatic()");
281281
assertThatExceptionOfType(SpelEvaluationException.class)
282282
.isThrownBy(() -> expression.getValue(context))

spring-jms/src/test/java/org/springframework/jms/support/converter/MappingJackson2MessageConverterTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ void fromTextMessageAsMap() throws Exception {
175175

176176
@Test
177177
void toTextMessageWithReturnType() throws JMSException, NoSuchMethodException {
178-
Method method = this.getClass().getDeclaredMethod("summary");
178+
Method method = getClass().getDeclaredMethod("summary");
179179
MethodParameter returnType = new MethodParameter(method, -1);
180180
testToTextMessageWithReturnType(returnType);
181181
verify(sessionMock).createTextMessage("{\"name\":\"test\"}");
@@ -189,7 +189,7 @@ void toTextMessageWithNullReturnType() throws JMSException, NoSuchMethodExceptio
189189

190190
@Test
191191
void toTextMessageWithReturnTypeAndNoJsonView() throws JMSException, NoSuchMethodException {
192-
Method method = this.getClass().getDeclaredMethod("none");
192+
Method method = getClass().getDeclaredMethod("none");
193193
MethodParameter returnType = new MethodParameter(method, -1);
194194

195195
testToTextMessageWithReturnType(returnType);
@@ -198,7 +198,7 @@ void toTextMessageWithReturnTypeAndNoJsonView() throws JMSException, NoSuchMetho
198198

199199
@Test
200200
void toTextMessageWithReturnTypeAndMultipleJsonViews() throws NoSuchMethodException {
201-
Method method = this.getClass().getDeclaredMethod("invalid");
201+
Method method = getClass().getDeclaredMethod("invalid");
202202
MethodParameter returnType = new MethodParameter(method, -1);
203203

204204
assertThatIllegalArgumentException().isThrownBy(() ->

spring-messaging/src/test/java/org/springframework/messaging/simp/annotation/support/SubscriptionMethodReturnValueHandlerTests.java

Lines changed: 8 additions & 8 deletions
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.
@@ -59,9 +59,9 @@
5959
* @author Sebastien Deleuze
6060
*/
6161
@ExtendWith(MockitoExtension.class)
62-
public class SubscriptionMethodReturnValueHandlerTests {
62+
class SubscriptionMethodReturnValueHandlerTests {
6363

64-
public static final MimeType MIME_TYPE = new MimeType("text", "plain", StandardCharsets.UTF_8);
64+
private static final MimeType MIME_TYPE = new MimeType("text", "plain", StandardCharsets.UTF_8);
6565

6666
private static final String PAYLOAD = "payload";
6767

@@ -95,16 +95,16 @@ void setup() throws Exception {
9595
jsonMessagingTemplate.setMessageConverter(new JacksonJsonMessageConverter());
9696
this.jsonHandler = new SubscriptionMethodReturnValueHandler(jsonMessagingTemplate);
9797

98-
Method method = this.getClass().getDeclaredMethod("getData");
98+
Method method = getClass().getDeclaredMethod("getData");
9999
this.subscribeEventReturnType = new MethodParameter(method, -1);
100100

101-
method = this.getClass().getDeclaredMethod("getDataAndSendTo");
101+
method = getClass().getDeclaredMethod("getDataAndSendTo");
102102
this.subscribeEventSendToReturnType = new MethodParameter(method, -1);
103103

104-
method = this.getClass().getDeclaredMethod("handle");
104+
method = getClass().getDeclaredMethod("handle");
105105
this.messageMappingReturnType = new MethodParameter(method, -1);
106106

107-
method = this.getClass().getDeclaredMethod("getJsonView");
107+
method = getClass().getDeclaredMethod("getJsonView");
108108
this.subscribeEventJsonViewReturnType = new MethodParameter(method, -1);
109109
}
110110

@@ -144,7 +144,7 @@ void testMessageSentToChannel() throws Exception {
144144

145145
@Test
146146
@SuppressWarnings({ "unchecked", "rawtypes" })
147-
public void testHeadersPassedToMessagingTemplate() throws Exception {
147+
void testHeadersPassedToMessagingTemplate() throws Exception {
148148
String sessionId = "sess1";
149149
String subscriptionId = "subs1";
150150
String destination = "/dest";

spring-test/src/test/java/org/springframework/test/util/subpackage/PersonEntity.java

Lines changed: 2 additions & 2 deletions
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.
@@ -110,7 +110,7 @@ public void setPrivateEye(String privateEye) {
110110
public String toString() {
111111
// @formatter:off
112112
return new ToStringCreator(this)
113-
.append("id", this.getId())
113+
.append("id", getId())
114114
.append("name", this.name)
115115
.append("age", this.age)
116116
.append("eyeColor", this.eyeColor)

0 commit comments

Comments
 (0)