Skip to content

Commit d274e89

Browse files
committed
Remove superfluous static declaration for enum, annotation, & interface
1 parent aa8b06b commit d274e89

File tree

40 files changed

+138
-177
lines changed

40 files changed

+138
-177
lines changed

spring-aop/src/test/java/org/springframework/aop/aspectj/TrickyAspectJPointcutExpressionTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2022 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.
@@ -142,11 +142,11 @@ public TestException(String string) {
142142
@Retention(RetentionPolicy.RUNTIME)
143143
@Documented
144144
@Inherited
145-
public static @interface Log {
145+
@interface Log {
146146
}
147147

148148

149-
public static interface TestService {
149+
public interface TestService {
150150

151151
public String sayHello();
152152
}

spring-aop/src/test/java/org/springframework/aop/framework/IntroductionBenchmarkTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public int getCount() {
4848
}
4949
}
5050

51-
public static interface Counter {
51+
public interface Counter {
5252
int getCount();
5353
}
5454

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ public interface ITester {
307307
}
308308

309309

310-
private static interface SubTimeStamped extends TimeStamped {
310+
private interface SubTimeStamped extends TimeStamped {
311311
}
312312

313313
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -278,19 +278,19 @@ public static class TestService2 {
278278
}
279279

280280

281-
public static interface TestServiceLocator {
281+
public interface TestServiceLocator {
282282

283283
TestService getTestService();
284284
}
285285

286286

287-
public static interface TestServiceLocator2 {
287+
public interface TestServiceLocator2 {
288288

289289
TestService getTestService(String id) throws CustomServiceLocatorException2;
290290
}
291291

292292

293-
public static interface TestServiceLocator3 {
293+
public interface TestServiceLocator3 {
294294

295295
TestService getTestService();
296296

@@ -302,13 +302,13 @@ public static interface TestServiceLocator3 {
302302
}
303303

304304

305-
public static interface TestService2Locator {
305+
public interface TestService2Locator {
306306

307307
TestService2 getTestService() throws CustomServiceLocatorException3;
308308
}
309309

310310

311-
public static interface ServiceLocatorInterfaceWithExtraNonCompliantMethod {
311+
public interface ServiceLocatorInterfaceWithExtraNonCompliantMethod {
312312

313313
TestService2 getTestService();
314314

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,36 +118,36 @@ void atAnnotationMethodAnnotationMatch() {
118118
assertThat(counter.atAnnotationMethodAnnotationCounter).isEqualTo(1);
119119
}
120120

121-
public static interface TestInterface {
121+
interface TestInterface {
122122
public void doIt();
123123
}
124124

125-
public static class TestImpl implements TestInterface {
125+
static class TestImpl implements TestInterface {
126126
@Override
127127
public void doIt() {
128128
}
129129
}
130130

131131
@Retention(RetentionPolicy.RUNTIME)
132-
public static @interface TestAnnotation {
132+
@interface TestAnnotation {
133133
}
134134

135135
@TestAnnotation
136-
public static class AnnotatedClassTestImpl implements TestInterface {
136+
static class AnnotatedClassTestImpl implements TestInterface {
137137
@Override
138138
public void doIt() {
139139
}
140140
}
141141

142-
public static class AnnotatedMethodTestImpl implements TestInterface {
142+
static class AnnotatedMethodTestImpl implements TestInterface {
143143
@Override
144144
@TestAnnotation
145145
public void doIt() {
146146
}
147147
}
148148

149149
@Aspect
150-
public static class Counter {
150+
static class Counter {
151151
int thisAsClassCounter;
152152
int thisAsInterfaceCounter;
153153
int targetAsClassCounter;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void testGenericInterfaceSubtypeGenericCollectionArgExecution() {
7979
}
8080

8181

82-
static interface GenericInterface<T> {
82+
interface GenericInterface<T> {
8383

8484
void save(T bean);
8585

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
@@ -1770,7 +1770,7 @@ public void adviceChanged(AdvisedSupport advised) {
17701770
}
17711771

17721772

1773-
public static interface IOverloads {
1773+
public interface IOverloads {
17741774

17751775
void overload();
17761776

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 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.
@@ -44,13 +44,13 @@
4444
* @author Chris Beams
4545
* @author Sam Brannen
4646
*/
47-
public class AnnotationBeanNameGeneratorTests {
47+
class AnnotationBeanNameGeneratorTests {
4848

4949
private AnnotationBeanNameGenerator beanNameGenerator = new AnnotationBeanNameGenerator();
5050

5151

5252
@Test
53-
public void generateBeanNameWithNamedComponent() {
53+
void generateBeanNameWithNamedComponent() {
5454
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
5555
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentWithName.class);
5656
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
@@ -60,7 +60,7 @@ public void generateBeanNameWithNamedComponent() {
6060
}
6161

6262
@Test
63-
public void generateBeanNameWithDefaultNamedComponent() {
63+
void generateBeanNameWithDefaultNamedComponent() {
6464
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
6565
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(DefaultNamedComponent.class);
6666
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
@@ -70,7 +70,7 @@ public void generateBeanNameWithDefaultNamedComponent() {
7070
}
7171

7272
@Test
73-
public void generateBeanNameWithNamedComponentWhereTheNameIsBlank() {
73+
void generateBeanNameWithNamedComponentWhereTheNameIsBlank() {
7474
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
7575
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentWithBlankName.class);
7676
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
@@ -81,7 +81,7 @@ public void generateBeanNameWithNamedComponentWhereTheNameIsBlank() {
8181
}
8282

8383
@Test
84-
public void generateBeanNameWithAnonymousComponentYieldsGeneratedBeanName() {
84+
void generateBeanNameWithAnonymousComponentYieldsGeneratedBeanName() {
8585
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
8686
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnonymousComponent.class);
8787
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
@@ -92,23 +92,23 @@ public void generateBeanNameWithAnonymousComponentYieldsGeneratedBeanName() {
9292
}
9393

9494
@Test
95-
public void generateBeanNameFromMetaComponentWithStringValue() {
95+
void generateBeanNameFromMetaComponentWithStringValue() {
9696
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
9797
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentFromStringMeta.class);
9898
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
9999
assertThat(beanName).isEqualTo("henry");
100100
}
101101

102102
@Test
103-
public void generateBeanNameFromMetaComponentWithNonStringValue() {
103+
void generateBeanNameFromMetaComponentWithNonStringValue() {
104104
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
105105
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentFromNonStringMeta.class);
106106
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
107107
assertThat(beanName).isEqualTo("annotationBeanNameGeneratorTests.ComponentFromNonStringMeta");
108108
}
109109

110110
@Test
111-
public void generateBeanNameFromComposedControllerAnnotationWithoutName() {
111+
void generateBeanNameFromComposedControllerAnnotationWithoutName() {
112112
// SPR-11360
113113
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
114114
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComposedControllerAnnotationWithoutName.class);
@@ -118,7 +118,7 @@ public void generateBeanNameFromComposedControllerAnnotationWithoutName() {
118118
}
119119

120120
@Test
121-
public void generateBeanNameFromComposedControllerAnnotationWithBlankName() {
121+
void generateBeanNameFromComposedControllerAnnotationWithBlankName() {
122122
// SPR-11360
123123
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
124124
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComposedControllerAnnotationWithBlankName.class);
@@ -128,7 +128,7 @@ public void generateBeanNameFromComposedControllerAnnotationWithBlankName() {
128128
}
129129

130130
@Test
131-
public void generateBeanNameFromComposedControllerAnnotationWithStringValue() {
131+
void generateBeanNameFromComposedControllerAnnotationWithStringValue() {
132132
// SPR-11360
133133
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
134134
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(
@@ -157,7 +157,7 @@ private static class ComponentFromStringMeta {
157157
@Retention(RetentionPolicy.RUNTIME)
158158
@Target(ElementType.TYPE)
159159
@Component
160-
public @interface NonStringMetaComponent {
160+
@interface NonStringMetaComponent {
161161

162162
long value();
163163
}
@@ -172,21 +172,21 @@ private static class ComponentFromNonStringMeta {
172172
@Retention(RetentionPolicy.RUNTIME)
173173
@Target(ElementType.TYPE)
174174
@Controller
175-
public static @interface TestRestController {
175+
@interface TestRestController {
176176

177177
String value() default "";
178178
}
179179

180180
@TestRestController
181-
public static class ComposedControllerAnnotationWithoutName {
181+
static class ComposedControllerAnnotationWithoutName {
182182
}
183183

184184
@TestRestController(" ")
185-
public static class ComposedControllerAnnotationWithBlankName {
185+
static class ComposedControllerAnnotationWithBlankName {
186186
}
187187

188188
@TestRestController("restController")
189-
public static class ComposedControllerAnnotationWithStringValue {
189+
static class ComposedControllerAnnotationWithStringValue {
190190
}
191191

192192
}

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 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.
@@ -27,17 +27,14 @@
2727

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

30-
31-
32-
3330
/**
3431
* @author Phillip Webb
3532
* @author Juergen Hoeller
3633
*/
37-
public class BeanMethodMetadataTests {
34+
class BeanMethodMetadataTests {
3835

3936
@Test
40-
public void providesBeanMethodBeanDefinition() throws Exception {
37+
void providesBeanMethodBeanDefinition() throws Exception {
4138
AnnotationConfigApplicationContext context= new AnnotationConfigApplicationContext(Conf.class);
4239
BeanDefinition beanDefinition = context.getBeanDefinition("myBean");
4340
assertThat(beanDefinition).as("should provide AnnotatedBeanDefinition").isInstanceOf(AnnotatedBeanDefinition.class);
@@ -53,7 +50,7 @@ static class Conf {
5350

5451
@Bean
5552
@MyAnnotation("test")
56-
public MyBean myBean() {
53+
MyBean myBean() {
5754
return new MyBean();
5855
}
5956
}
@@ -64,7 +61,7 @@ static class MyBean {
6461

6562

6663
@Retention(RetentionPolicy.RUNTIME)
67-
public static @interface MyAnnotation {
64+
@interface MyAnnotation {
6865

6966
String value();
7067
}

spring-context/src/test/java/org/springframework/context/annotation/spr8761/Spr8761Tests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ class WithNestedAnnotation {
5353

5454
@Retention(RetentionPolicy.RUNTIME)
5555
@Component
56-
public static @interface MyComponent {
56+
@interface MyComponent {
5757
}
5858
}

0 commit comments

Comments
 (0)