Skip to content

Commit 49ff96d

Browse files
committed
Merge pull request #31368 from izeye
* pr/31368: Polish "Order modifiers to align with JLS" Order modifiers to align with JLS Closes gh-31368
2 parents f60791a + 5c6232e commit 49ff96d

File tree

111 files changed

+180
-174
lines changed

Some content is hidden

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

111 files changed

+180
-174
lines changed

buildSrc/config/checkstyle/checkstyle.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
<property name="processJavadoc" value="true"/>
2020
</module>
2121

22+
<!-- Modifiers -->
23+
<module name="com.puppycrawl.tools.checkstyle.checks.modifier.ModifierOrderCheck"/>
24+
2225
</module>
2326

2427
</module>

integration-tests/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ public interface IScopedTestBean {
344344
}
345345

346346

347-
public static abstract class ScopedTestBean implements IScopedTestBean {
347+
public abstract static class ScopedTestBean implements IScopedTestBean {
348348

349349
private String name = DEFAULT_NAME;
350350

integration-tests/src/test/java/org/springframework/context/annotation/scope/ClassPathBeanDefinitionScannerScopeIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ interface IScopedTestBean {
306306
}
307307

308308

309-
static abstract class ScopedTestBean implements IScopedTestBean {
309+
abstract static class ScopedTestBean implements IScopedTestBean {
310310

311311
private String name = DEFAULT_NAME;
312312

spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
*/
3737
public class MethodMatchersTests {
3838

39-
private final static Method TEST_METHOD = mock(Method.class);
39+
private static final Method TEST_METHOD = mock(Method.class);
4040

4141
private final Method EXCEPTION_GETMESSAGE;
4242

spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanInstanceSupplier.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ private static String toCommaSeparatedNames(Class<?>... parameterTypes) {
410410
/**
411411
* Performs lookup of the {@link Executable}.
412412
*/
413-
static abstract class ExecutableLookup {
413+
abstract static class ExecutableLookup {
414414

415415
abstract Executable get(RegisteredBean registeredBean);
416416
}

spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ public D getData() {
582582
}
583583

584584

585-
private static abstract class BaseGenericCollectionBean {
585+
private abstract static class BaseGenericCollectionBean {
586586

587587
public abstract Object getMapOfInteger();
588588

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3030,7 +3030,7 @@ public void close() {
30303030
}
30313031

30323032

3033-
public static abstract class BaseClassWithDestroyMethod {
3033+
public abstract static class BaseClassWithDestroyMethod {
30343034

30353035
public abstract BaseClassWithDestroyMethod close();
30363036
}
@@ -3089,7 +3089,7 @@ public interface RepositoryFactoryInformation<T, ID extends Serializable> {
30893089
}
30903090

30913091

3092-
public static abstract class RepositoryFactoryBeanSupport<T extends Repository<S, ID>, S, ID extends Serializable>
3092+
public abstract static class RepositoryFactoryBeanSupport<T extends Repository<S, ID>, S, ID extends Serializable>
30933093
implements RepositoryFactoryInformation<S, ID>, FactoryBean<T> {
30943094
}
30953095

spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4161,7 +4161,7 @@ public Thread call() throws Exception {
41614161
}
41624162

41634163

4164-
public static abstract class Foo<T extends Runnable, RT extends Callable<T>> {
4164+
public abstract static class Foo<T extends Runnable, RT extends Callable<T>> {
41654165

41664166
private RT obj;
41674167

spring-beans/src/test/java/org/springframework/beans/factory/annotation/LookupAnnotationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public void testPrototypeWithoutMetadataCaching() {
156156
}
157157

158158

159-
public static abstract class AbstractBean {
159+
public abstract static class AbstractBean {
160160

161161
@Lookup("testBean")
162162
public abstract TestBean get();
@@ -194,7 +194,7 @@ public static class FloatStore extends NumberStore<Float> {
194194
}
195195

196196

197-
public static abstract class NumberBean {
197+
public abstract static class NumberBean {
198198

199199
@Lookup
200200
public abstract NumberStore<Double> getDoubleStore();

spring-beans/src/test/java/org/springframework/beans/factory/support/LookupMethodTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void testWithGenericBean() {
113113
}
114114

115115

116-
public static abstract class AbstractBean {
116+
public abstract static class AbstractBean {
117117

118118
public abstract TestBean get();
119119

@@ -139,7 +139,7 @@ public static class FloatStore extends NumberStore<Float> {
139139
}
140140

141141

142-
public static abstract class NumberBean {
142+
public abstract static class NumberBean {
143143

144144
public abstract NumberStore<Double> getDoubleStore();
145145

spring-context/src/main/java/org/springframework/context/support/DefaultLifecycleProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
8888
public static final String CHECKPOINT_ON_REFRESH_VALUE = "onRefresh";
8989

9090

91-
private final static boolean checkpointOnRefresh =
91+
private static final boolean checkpointOnRefresh =
9292
CHECKPOINT_ON_REFRESH_VALUE.equalsIgnoreCase(SpringProperties.getProperty(CHECKPOINT_PROPERTY_NAME));
9393

9494
private final Log logger = LogFactory.getLog(getClass());

spring-context/src/main/java/org/springframework/validation/beanvalidation/MethodValidationAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ public String resolveName(MethodParameter parameter, @Nullable Object value) {
519519
* also falling back on container indexes if necessary for cascaded
520520
* constraints on a List container.
521521
*/
522-
private final static class ResultComparator implements Comparator<ParameterValidationResult> {
522+
private static final class ResultComparator implements Comparator<ParameterValidationResult> {
523523

524524
@Override
525525
public int compare(ParameterValidationResult result1, ParameterValidationResult result2) {

spring-context/src/main/java/org/springframework/validation/beanvalidation/MethodValidationInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ protected Class<?>[] determineValidationGroups(MethodInvocation invocation) {
234234
/**
235235
* Helper class to decorate reactive arguments with async validation.
236236
*/
237-
private final static class ReactorValidationHelper {
237+
private static final class ReactorValidationHelper {
238238

239239
private static final ReactiveAdapterRegistry reactiveAdapterRegistry =
240240
ReactiveAdapterRegistry.getSharedInstance();

spring-context/src/test/java/org/springframework/aop/aspectj/TargetPointcutSelectionTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ interface TestInterface {
8787

8888
// Reproducing bug requires that the class specified in target() pointcut doesn't
8989
// include the advised method's implementation (instead a base class should include it)
90-
static abstract class AbstractTestImpl implements TestInterface {
90+
abstract static class AbstractTestImpl implements TestInterface {
9191

9292
@Override
9393
public void interfaceMethod() {

spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1915,7 +1915,7 @@ public boolean isStatic() {
19151915
}
19161916

19171917

1918-
static abstract class ExposedInvocationTestBean extends TestBean {
1918+
abstract static class ExposedInvocationTestBean extends TestBean {
19191919

19201920
@Override
19211921
public String getName() {

spring-context/src/test/java/org/springframework/beans/factory/annotation/BridgeMethodAutowiringTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void SPR8434() {
3535
}
3636

3737

38-
static abstract class GenericServiceImpl<D> {
38+
abstract static class GenericServiceImpl<D> {
3939

4040
public abstract void setObject(D object);
4141
}

spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,23 +1131,23 @@ void testBeanDefinitionRegistryPostProcessorConfig() {
11311131
@Order(1)
11321132
static class SingletonBeanConfig {
11331133

1134-
public @Bean Foo foo() {
1134+
@Bean public Foo foo() {
11351135
return new Foo();
11361136
}
11371137

1138-
public @Bean Bar bar() {
1138+
@Bean public Bar bar() {
11391139
return new Bar(foo());
11401140
}
11411141
}
11421142

11431143
@Configuration(proxyBeanMethods = false)
11441144
static class NonEnhancedSingletonBeanConfig {
11451145

1146-
public @Bean Foo foo() {
1146+
@Bean public Foo foo() {
11471147
return new Foo();
11481148
}
11491149

1150-
public @Bean Bar bar() {
1150+
@Bean public Bar bar() {
11511151
return new Bar(foo());
11521152
}
11531153
}
@@ -1168,27 +1168,27 @@ static class StaticSingletonBeanConfig {
11681168
@Order(2)
11691169
static class OverridingSingletonBeanConfig {
11701170

1171-
public @Bean ExtendedFoo foo() {
1171+
@Bean public ExtendedFoo foo() {
11721172
return new ExtendedFoo();
11731173
}
11741174

1175-
public @Bean Bar bar() {
1175+
@Bean public Bar bar() {
11761176
return new Bar(foo());
11771177
}
11781178
}
11791179

11801180
@Configuration
11811181
static class OverridingAgainSingletonBeanConfig {
11821182

1183-
public @Bean ExtendedAgainFoo foo() {
1183+
@Bean public ExtendedAgainFoo foo() {
11841184
return new ExtendedAgainFoo();
11851185
}
11861186
}
11871187

11881188
@Configuration
11891189
static class InvalidOverridingSingletonBeanConfig {
11901190

1191-
public @Bean Foo foo() {
1191+
@Bean public Foo foo() {
11921192
return new Foo();
11931193
}
11941194
}
@@ -1200,11 +1200,11 @@ static class ConfigWithOrderedNestedClasses {
12001200
@Order(1)
12011201
static class SingletonBeanConfig {
12021202

1203-
public @Bean Foo foo() {
1203+
@Bean public Foo foo() {
12041204
return new Foo();
12051205
}
12061206

1207-
public @Bean Bar bar() {
1207+
@Bean public Bar bar() {
12081208
return new Bar(foo());
12091209
}
12101210
}
@@ -1213,11 +1213,11 @@ static class SingletonBeanConfig {
12131213
@Order(2)
12141214
static class OverridingSingletonBeanConfig {
12151215

1216-
public @Bean ExtendedFoo foo() {
1216+
@Bean public ExtendedFoo foo() {
12171217
return new ExtendedFoo();
12181218
}
12191219

1220-
public @Bean Bar bar() {
1220+
@Bean public Bar bar() {
12211221
return new Bar(foo());
12221222
}
12231223
}
@@ -1233,11 +1233,11 @@ class SingletonBeanConfig {
12331233
public SingletonBeanConfig(ConfigWithOrderedInnerClasses other) {
12341234
}
12351235

1236-
public @Bean Foo foo() {
1236+
@Bean public Foo foo() {
12371237
return new Foo();
12381238
}
12391239

1240-
public @Bean Bar bar() {
1240+
@Bean public Bar bar() {
12411241
return new Bar(foo());
12421242
}
12431243
}
@@ -1250,11 +1250,11 @@ public OverridingSingletonBeanConfig(ObjectProvider<SingletonBeanConfig> other)
12501250
other.getObject();
12511251
}
12521252

1253-
public @Bean ExtendedFoo foo() {
1253+
@Bean public ExtendedFoo foo() {
12541254
return new ExtendedFoo();
12551255
}
12561256

1257-
public @Bean Bar bar() {
1257+
@Bean public Bar bar() {
12581258
return new Bar(foo());
12591259
}
12601260
}
@@ -1281,15 +1281,15 @@ public Bar(Foo foo) {
12811281
@Configuration
12821282
static class UnloadedConfig {
12831283

1284-
public @Bean Foo foo() {
1284+
@Bean public Foo foo() {
12851285
return new Foo();
12861286
}
12871287
}
12881288

12891289
@Configuration
12901290
static class LoadedConfig {
12911291

1292-
public @Bean Bar bar() {
1292+
@Bean public Bar bar() {
12931293
return new Bar(new Foo());
12941294
}
12951295
}
@@ -1707,7 +1707,7 @@ public String getParameter() {
17071707
}
17081708

17091709
@Configuration
1710-
public static abstract class AbstractConfig {
1710+
public abstract static class AbstractConfig {
17111711

17121712
@Bean
17131713
public ServiceBean serviceBean() {
@@ -1891,7 +1891,7 @@ static class DependingFoo {
18911891
}
18921892
}
18931893

1894-
static abstract class FooFactory {
1894+
abstract static class FooFactory {
18951895

18961896
abstract DependingFoo createFoo(BarArgument bar);
18971897
}
@@ -2010,7 +2010,7 @@ private boolean testBean(boolean param) {
20102010
}
20112011

20122012
@Configuration
2013-
static abstract class BeanLookupConfiguration {
2013+
abstract static class BeanLookupConfiguration {
20142014

20152015
@Bean
20162016
public TestBean thing() {

spring-context/src/test/java/org/springframework/context/annotation/ReflectionUtilsIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void getUniqueDeclaredMethods_withCovariantReturnType_andCglibRewrittenMe
5454

5555

5656
@Configuration
57-
static abstract class Parent {
57+
abstract static class Parent {
5858
public abstract Number m1();
5959
}
6060

spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ public Set<String> get() {
432432
@Configuration
433433
static class ConfigWithFinalBean {
434434

435-
public final @Bean TestBean testBean() {
435+
@Bean public final TestBean testBean() {
436436
return new TestBean();
437437
}
438438
}
@@ -441,15 +441,15 @@ static class ConfigWithFinalBean {
441441
@Configuration
442442
static class ConfigWithVoidBean {
443443

444-
public @Bean void testBean() {
444+
@Bean public void testBean() {
445445
}
446446
}
447447

448448

449449
@Configuration
450450
static class SimplestPossibleConfig {
451451

452-
public @Bean String stringBean() {
452+
@Bean public String stringBean() {
453453
return "foo";
454454
}
455455
}
@@ -458,11 +458,11 @@ static class SimplestPossibleConfig {
458458
@Configuration
459459
static class ConfigWithNonSpecificReturnTypes {
460460

461-
public @Bean Object stringBean() {
461+
@Bean public Object stringBean() {
462462
return "foo";
463463
}
464464

465-
public @Bean FactoryBean<?> factoryBean() {
465+
@Bean public FactoryBean<?> factoryBean() {
466466
ListFactoryBean fb = new ListFactoryBean();
467467
fb.setSourceList(Arrays.asList("element1", "element2"));
468468
return fb;
@@ -473,13 +473,13 @@ static class ConfigWithNonSpecificReturnTypes {
473473
@Configuration
474474
static class ConfigWithPrototypeBean {
475475

476-
public @Bean TestBean foo() {
476+
@Bean public TestBean foo() {
477477
TestBean foo = new SpousyTestBean("foo");
478478
foo.setSpouse(bar());
479479
return foo;
480480
}
481481

482-
public @Bean TestBean bar() {
482+
@Bean public TestBean bar() {
483483
TestBean bar = new SpousyTestBean("bar");
484484
bar.setSpouse(baz());
485485
return bar;

0 commit comments

Comments
 (0)