Skip to content

Commit 57da58d

Browse files
author
Vincent Potucek
committed
RemoveUnused
1 parent 255c560 commit 57da58d

File tree

33 files changed

+103
-10
lines changed

33 files changed

+103
-10
lines changed

.editorconfig

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
[*]
1+
root = true
2+
3+
[*.{adoc,bat,groovy,html,java,js,jsp,kt,kts,md,properties,py,rb,sh,sql,svg,txt,xml,xsd}]
24
charset = utf-8
3-
end_of_line = lf
45

56
[*.{groovy,java,kt,kts,xml,xsd}]
6-
ij_continuation_indent_size = 8
7-
indent_size = 4
87
indent_style = tab
9-
max_line_length = 120
8+
indent_size = 4
9+
continuation_indent_size = 8
10+
end_of_line = lf

buildSrc/config/checkstyle/checkstyle.xml

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
<module name="RedundantImport"/>
2121
<!-- Modifiers -->
2222
<module name="com.puppycrawl.tools.checkstyle.checks.modifier.ModifierOrderCheck"/>
23-
<!-- <module name="FinalLocalVariable"/>-->
2423

2524
</module>
2625

framework-docs/src/main/java/org/springframework/docs/integration/cache/cachestoreconfigurationnoop/CacheConfiguration.java

+8
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@
2626
@Configuration
2727
class CacheConfiguration {
2828

29+
private CacheManager jdkCache() {
30+
return null;
31+
}
32+
33+
private CacheManager gemfireCache() {
34+
return null;
35+
}
36+
2937
// tag::snippet[]
3038
@Bean
3139
CacheManager cacheManager(CacheManager jdkCache, CacheManager gemfireCache) {

framework-docs/src/main/java/org/springframework/docs/testing/mockmvc/assertj/mockmvctestersetup/AccountControllerStandaloneTests.java

+4
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@
1616

1717
package org.springframework.docs.testing.mockmvc.assertj.mockmvctestersetup;
1818

19+
import org.springframework.test.web.servlet.assertj.MockMvcTester;
20+
1921
// tag::snippet[]
2022
public class AccountControllerStandaloneTests {
2123

24+
private final MockMvcTester mockMvc = MockMvcTester.of(new AccountController());
25+
2226
// ...
2327

2428
}

framework-docs/src/main/java/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigpathmatching/WebConfiguration.java

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import org.springframework.web.method.HandlerTypePredicate;
66
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
77
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
8+
import org.springframework.web.util.pattern.PathPatternParser;
89

910
// tag::snippet[]
1011
@Configuration
@@ -14,5 +15,11 @@ public class WebConfiguration implements WebMvcConfigurer {
1415
public void configurePathMatch(PathMatchConfigurer configurer) {
1516
configurer.addPathPrefix("/api", HandlerTypePredicate.forAnnotation(RestController.class));
1617
}
18+
19+
private PathPatternParser patternParser() {
20+
PathPatternParser pathPatternParser = new PathPatternParser();
21+
// ...
22+
return pathPatternParser;
23+
}
1724
}
1825
// end::snippet[]

import-into-eclipse.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ _When instructed to execute `./gradlew` from the command line, be sure to execut
4848
1. While JUnit tests pass from the command line with Gradle, some may fail when run from
4949
the IDE.
5050
- Resolving this is a work in progress.
51-
- If attempting to run all JUnit tests from within the IDE, you may need to set the following VM options to avoid out
52-
of memory errors: `-XX:MaxPermSize=2g -Xmx2g -XX:MaxHeapSize=2g`
51+
- If attempting to run all JUnit tests from within the IDE, you may need to set the following VM options to avoid out of memory errors: `-XX:MaxPermSize=2048m -Xmx2048m -XX:MaxHeapSize=2048m`
5352

5453
## Tips
5554

import-into-idea.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ IntelliJ IDEA. See https://youtrack.jetbrains.com/issue/IDEA-64446 for details.
1919
3. While JUnit tests pass from the command line with Gradle, some may fail when run from
2020
IntelliJ IDEA. Resolving this is a work in progress. If attempting to run all JUnit tests from within
2121
IntelliJ IDEA, you will likely need to set the following VM options to avoid out of memory errors:
22-
-XX:MaxPermSize=2g -Xmx2g -XX:MaxHeapSize=2g
22+
-XX:MaxPermSize=2048m -Xmx2048m -XX:MaxHeapSize=2048m
2323
4. If you invoke "Rebuild Project" in the IDE, you'll have to generate some test
2424
resources of the `spring-oxm` module again (`./gradlew :spring-oxm:compileTestJava`)
2525

integration-tests/src/test/java/org/springframework/aot/test/SampleReflection.java

+2
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ public class SampleReflection {
2626

2727
@SuppressWarnings("unused")
2828
public void sample() {
29+
String value = "Sample";
2930
Method[] methods = String.class.getMethods();
3031
}
3132

3233
@SuppressWarnings("unused")
3334
public void multipleCalls() {
35+
String value = "Sample";
3436
Method[] methods = String.class.getMethods();
3537
methods = Integer.class.getMethods();
3638
}

spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectJAdvisorBeanRegistrationAotProcessorTests.java

+2
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@ void process(Class<?> beanClass) {
7474

7575

7676
static class AspectJClass {
77+
private static java.lang.Throwable ajc$initFailureCause;
7778
}
7879

7980
static class RegularClass {
81+
private static java.lang.Throwable initFailureCause;
8082
}
8183

8284
}

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

+10
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,16 @@ public void setCounter3(int counter3) {
183183
@SuppressWarnings("unused")
184184
private static class SampleFieldProperties {
185185

186+
private String name;
187+
188+
private String description;
189+
190+
private int counter1;
191+
192+
private int counter2;
193+
194+
private int counter3;
195+
186196
}
187197

188198
}

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

+2
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ private static class QualifiedTestBean {
257257
@TestQualifier
258258
private Person qualified;
259259

260+
private Person nonqualified;
261+
260262
public QualifiedTestBean(@TestQualifier Person tpb) {
261263
}
262264

spring-context/src/main/java/org/springframework/scripting/support/StandardScriptFactory.java

+9
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.lang.reflect.InvocationTargetException;
2121

2222
import javax.script.Invocable;
23+
import javax.script.ScriptEngine;
2324
import javax.script.ScriptEngineManager;
2425

2526
import org.jspecify.annotations.Nullable;
@@ -49,8 +50,16 @@
4950
*/
5051
public class StandardScriptFactory implements ScriptFactory, BeanClassLoaderAware {
5152

53+
private final @Nullable String scriptEngineName;
54+
5255
private final String scriptSourceLocator;
5356

57+
private final Class<?> @Nullable [] scriptInterfaces;
58+
59+
private @Nullable ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
60+
61+
private volatile @Nullable ScriptEngine scriptEngine;
62+
5463

5564
/**
5665
* Create a new StandardScriptFactory for the given script source.

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

+8
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,14 @@ public DerivedConstructorDependenciesBean(TestBean spouse1, TestBean spouse2, In
215215
setAge(age);
216216
setName(name);
217217
}
218+
219+
private void init() {
220+
this.initialized = true;
221+
}
222+
223+
private void destroy() {
224+
this.destroyed = true;
225+
}
218226
}
219227

220228

spring-context/src/test/java/org/springframework/context/aot/ReflectiveProcessorBeanFactoryInitializationAotProcessorTests.java

+2
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ private void process(Class<?>... beanClasses) {
127127
@SuppressWarnings("unused")
128128
static class SampleTypeAnnotatedBean {
129129

130+
private String notManaged;
131+
130132
public void notManaged() {
131133

132134
}

spring-context/src/test/resources/org/springframework/scripting/groovy/ScriptBean.groovy

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import org.springframework.scripting.ContextScriptBean
77

88
class GroovyScriptBean implements ContextScriptBean, ApplicationContextAware {
99

10+
private int age
11+
1012
@Override
1113
int getAge() {
1214
return this.age

spring-context/src/testFixtures/java/org/springframework/context/testfixture/context/aot/scan/reflective/ReflectiveOnField.java

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
@SuppressWarnings("unused")
2222
public class ReflectiveOnField {
2323

24+
private String name;
25+
2426
@Reflective
2527
private String description;
2628

spring-core/src/test/java/org/springframework/aot/generate/PublicClass.java

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
@SuppressWarnings("unused")
2020
public class PublicClass {
2121

22+
private String privateField;
23+
2224
String protectedField;
2325

2426
public PackagePrivateClass[] packagePrivateClasses;

spring-core/src/test/java/org/springframework/aot/hint/ReflectionHintsTests.java

+2
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ private Consumer<TypeHint> typeWithMemberCategories(Class<?> type, MemberCategor
246246
@SuppressWarnings("unused")
247247
static class TestType {
248248

249+
private @Nullable String field;
250+
249251
void setName(String name) {
250252

251253
}

spring-core/src/test/java/org/springframework/aot/hint/annotation/ReflectiveRuntimeHintsRegistrarTests.java

+2
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ private void process(Class<?> beanClass) {
167167
@SuppressWarnings("unused")
168168
static class SampleTypeAnnotatedBean {
169169

170+
private String notManaged;
171+
170172
public void notManaged() {
171173
}
172174
}

spring-core/src/test/java/org/springframework/aot/hint/predicate/ReflectionHintsPredicatesTests.java

+2
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,8 @@ private void assertPredicateDoesNotMatch(Predicate<RuntimeHints> predicate) {
447447
@SuppressWarnings("unused")
448448
static class SampleClass {
449449

450+
private String privateField;
451+
450452
public String publicField;
451453

452454
public SampleClass() {

spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java

+2
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,8 @@ public static class GenericBroadcasterImpl implements Broadcaster {
802802
public abstract static class GenericEventBroadcasterImpl<T extends Event>
803803
extends GenericBroadcasterImpl implements EventBroadcaster {
804804

805+
private Class<T>[] subscribingEvents;
806+
805807
private Channel<T> channel;
806808

807809
/**

spring-expression/src/test/java/org/springframework/expression/spel/testresources/Inventor.java

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public class Inventor {
3737
public String publicName;
3838
private PlaceOfBirth placeOfBirth;
3939
private Date birthdate;
40+
private int sinNumber;
4041
private String nationality;
4142
private String[] inventions;
4243
public String randomField;

spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java

+4
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,15 @@ public jakarta.xml.bind.Unmarshaller createUnmarshaller() {
377377
@XmlRootElement
378378
@SuppressWarnings("unused")
379379
public static class DummyRootElement {
380+
381+
private DummyType t = new DummyType();
380382
}
381383

382384
@XmlType
383385
@SuppressWarnings("unused")
384386
public static class DummyType {
387+
388+
private String s = "Hello";
385389
}
386390

387391
@SuppressWarnings("unused")

spring-test/src/main/java/org/springframework/test/web/servlet/DefaultMvcResult.java

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ class DefaultMvcResult implements MvcResult {
4848

4949
private @Nullable Object handler;
5050

51+
private HandlerInterceptor @Nullable [] interceptors;
52+
5153
private @Nullable ModelAndView modelAndView;
5254

5355
private @Nullable Exception resolvedException;

spring-webflux/src/main/java/org/springframework/web/reactive/resource/PathResourceResolver.java

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
*/
4343
public class PathResourceResolver extends AbstractResourceResolver {
4444

45+
private Resource @Nullable [] allowedLocations;
46+
4547

4648
/**
4749
* By default, when a Resource is found, the path of the resolved resource is

spring-webflux/src/main/java/org/springframework/web/reactive/result/view/UrlBasedViewResolver.java

+2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ public class UrlBasedViewResolver extends ViewResolverSupport
8080

8181
private String suffix = "";
8282

83+
private String @Nullable [] viewNames;
84+
8385
private Function<String, RedirectView> redirectViewProvider = RedirectView::new;
8486

8587
private @Nullable String requestContextAttribute;

spring-webmvc/src/main/java/org/springframework/web/servlet/i18n/LocaleChangeInterceptor.java

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public class LocaleChangeInterceptor implements HandlerInterceptor {
5252

5353
private String paramName = DEFAULT_PARAM_NAME;
5454

55+
private String @Nullable [] httpMethods;
56+
5557
private boolean ignoreInvalidLocale = false;
5658

5759

spring-webmvc/src/main/java/org/springframework/web/servlet/resource/PathResourceResolver.java

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
*/
5555
public class PathResourceResolver extends AbstractResourceResolver {
5656

57+
private Resource @Nullable [] allowedLocations;
58+
5759
private final Map<Resource, Charset> locationCharsets = new HashMap<>(4);
5860

5961
private @Nullable UrlPathHelper urlPathHelper;

spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import org.springframework.util.StringUtils;
5454
import org.springframework.util.StringValueResolver;
5555
import org.springframework.web.HttpRequestHandler;
56+
import org.springframework.web.accept.ContentNegotiationManager;
5657
import org.springframework.web.context.request.ServletWebRequest;
5758
import org.springframework.web.context.support.ServletContextResource;
5859
import org.springframework.web.cors.CorsConfiguration;
@@ -122,6 +123,8 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
122123

123124
private @Nullable ResourceRegionHttpMessageConverter resourceRegionHttpMessageConverter;
124125

126+
private @Nullable ContentNegotiationManager contentNegotiationManager;
127+
125128
private final Map<String, MediaType> mediaTypes = new HashMap<>(4);
126129

127130
private @Nullable CorsConfiguration corsConfiguration;

spring-webmvc/src/main/java/org/springframework/web/servlet/view/RedirectView.java

+2
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ public class RedirectView extends AbstractUrlBasedView implements SmartView {
103103

104104
private boolean propagateQueryParams = false;
105105

106+
private String @Nullable [] hosts;
107+
106108

107109
/**
108110
* Constructor for use as a bean.

spring-webmvc/src/main/java/org/springframework/web/servlet/view/UrlBasedViewResolver.java

+4
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements
116116

117117
private boolean redirectHttp10Compatible = true;
118118

119+
private String @Nullable [] redirectHosts;
120+
119121
private @Nullable String requestContextAttribute;
120122

121123
/** Map of static attributes, keyed by attribute name (String). */
@@ -125,6 +127,8 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements
125127

126128
private @Nullable Boolean exposeContextBeansAsAttributes;
127129

130+
private String @Nullable [] exposedContextBeanNames;
131+
128132
private String @Nullable [] viewNames;
129133

130134
private int order = Ordered.LOWEST_PRECEDENCE;

spring-websocket/src/main/java/org/springframework/web/socket/sockjs/client/SockJsClient.java

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ public class SockJsClient implements WebSocketClient, Lifecycle {
7272

7373
private final List<Transport> transports;
7474

75+
private String @Nullable [] httpHeaderNames;
76+
7577
private InfoReceiver infoReceiver;
7678

7779
private @Nullable SockJsMessageCodec messageCodec;

src/checkstyle/checkstyle.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
<property name="names" value="logger"/>
8888
</module>
8989
<module name="com.puppycrawl.tools.checkstyle.checks.coding.OneStatementPerLineCheck"/>
90-
<!-- <module name="FinalLocalVariable"/>-->
90+
9191
<!-- Imports -->
9292
<module name="AvoidStarImport"/>
9393
<module name="UnusedImports"/>

0 commit comments

Comments
 (0)