Skip to content

Commit 45c3285

Browse files
committed
Fix Checkstyle upgrade
Closes gh-38746
1 parent 4699923 commit 45c3285

File tree

135 files changed

+329
-324
lines changed

Some content is hidden

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

135 files changed

+329
-324
lines changed

buildSrc/build.gradle

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ if (versions.springFramework.contains("-")) {
3030
}
3131
}
3232

33+
checkstyle {
34+
toolVersion = "10.12.4"
35+
}
36+
3337
dependencies {
34-
checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:${javaFormatVersion}"
38+
checkstyle("com.puppycrawl.tools:checkstyle:${checkstyle.toolVersion}")
39+
checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:${javaFormatVersion}")
3540

3641
implementation(platform("org.springframework:spring-framework-bom:${versions.springFramework}"))
3742
implementation("com.diffplug.gradle:goomph:3.37.2")
@@ -57,10 +62,6 @@ dependencies {
5762
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
5863
}
5964

60-
checkstyle {
61-
toolVersion = "10.12.4"
62-
}
63-
6465
gradlePlugin {
6566
plugins {
6667
annotationProcessorPlugin {

buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 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.
@@ -243,6 +243,8 @@ private void configureSpringJavaFormat(Project project) {
243243
checkstyle.getConfigDirectory().set(project.getRootProject().file("src/checkstyle"));
244244
String version = SpringJavaFormatPlugin.class.getPackage().getImplementationVersion();
245245
DependencySet checkstyleDependencies = project.getConfigurations().getByName("checkstyle").getDependencies();
246+
checkstyleDependencies
247+
.add(project.getDependencies().create("com.puppycrawl.tools:checkstyle:" + checkstyle.getToolVersion()));
246248
checkstyleDependencies
247249
.add(project.getDependencies().create("io.spring.javaformat:spring-javaformat-checkstyle:" + version));
248250
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/SkipSslVerificationHttpRequestFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2024 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.
@@ -62,7 +62,7 @@ private SSLSocketFactory createSslSocketFactory() throws Exception {
6262
return context.getSocketFactory();
6363
}
6464

65-
private static class SkipHostnameVerifier implements HostnameVerifier {
65+
private static final class SkipHostnameVerifier implements HostnameVerifier {
6666

6767
@Override
6868
public boolean verify(String s, SSLSession sslSession) {
@@ -71,7 +71,7 @@ public boolean verify(String s, SSLSession sslSession) {
7171

7272
}
7373

74-
private static class SkipX509TrustManager implements X509TrustManager {
74+
private static final class SkipX509TrustManager implements X509TrustManager {
7575

7676
@Override
7777
public X509Certificate[] getAcceptedIssuers() {

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/logging/LogFileWebEndpointAutoConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2024 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.
@@ -54,7 +54,7 @@ public LogFileWebEndpoint logFileWebEndpoint(ObjectProvider<LogFile> logFile,
5454
return new LogFileWebEndpoint(logFile.getIfAvailable(), properties.getExternalFile());
5555
}
5656

57-
private static class LogFileCondition extends SpringBootCondition {
57+
private static final class LogFileCondition extends SpringBootCondition {
5858

5959
@Override
6060
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/jersey/JerseyServerMetricsAutoConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2024 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.
@@ -93,7 +93,7 @@ public MeterFilter jerseyMetricsUriTagFilter() {
9393
/**
9494
* An {@link AnnotationFinder} that uses {@link AnnotationUtils}.
9595
*/
96-
private static class AnnotationUtilsAnnotationFinder implements AnnotationFinder {
96+
private static final class AnnotationUtilsAnnotationFinder implements AnnotationFinder {
9797

9898
@Override
9999
public <A extends Annotation> A findAnnotation(AnnotatedElement annotatedElement, Class<A> annotationType) {

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/EndpointRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 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.
@@ -311,7 +311,7 @@ protected RequestMatcher createDelegate(WebApplicationContext context,
311311
/**
312312
* Factory used to create a {@link RequestMatcher}.
313313
*/
314-
private static class RequestMatcherFactory {
314+
private static final class RequestMatcherFactory {
315315

316316
RequestMatcher antPath(RequestMatcherProvider matcherProvider, String... parts) {
317317
StringBuilder pattern = new StringBuilder();

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryReactiveHealthEndpointWebExtensionTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 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.
@@ -73,7 +73,7 @@ void healthComponentsAlwaysPresent() {
7373
});
7474
}
7575

76-
private static class TestHealthIndicator implements HealthIndicator {
76+
private static final class TestHealthIndicator implements HealthIndicator {
7777

7878
@Override
7979
public Health health() {

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryHealthEndpointWebExtensionTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 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.
@@ -70,7 +70,7 @@ void healthComponentsAlwaysPresent() {
7070
});
7171
}
7272

73-
private static class TestHealthIndicator implements HealthIndicator {
73+
private static final class TestHealthIndicator implements HealthIndicator {
7474

7575
@Override
7676
public Health health() {

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/HealthEndpointDocumentationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 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.
@@ -138,7 +138,7 @@ CompositeHealthContributor brokerHealthContributor() {
138138

139139
}
140140

141-
private static class TestHealthEndpointGroup implements HealthEndpointGroup {
141+
private static final class TestHealthEndpointGroup implements HealthEndpointGroup {
142142

143143
private final StatusAggregator statusAggregator = new SimpleStatusAggregator();
144144

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/ObservationAutoConfigurationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 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.
@@ -493,11 +493,11 @@ public boolean supportsContext(Context context) {
493493

494494
}
495495

496-
private static class CustomContext extends Context {
496+
private static final class CustomContext extends Context {
497497

498498
}
499499

500-
private static class CalledHandlers {
500+
private static final class CalledHandlers {
501501

502502
private final List<ObservationHandler<?>> calledHandlers = new ArrayList<>();
503503

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/ObservationRegistryConfigurerIntegrationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 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.
@@ -74,7 +74,7 @@ Customizer2 customizer2(CalledCustomizers calledCustomizers) {
7474

7575
}
7676

77-
private static class CalledCustomizers {
77+
private static final class CalledCustomizers {
7878

7979
private final List<ObservationRegistryCustomizer<?>> customizers = new ArrayList<>();
8080

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/BraveAutoConfigurationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 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.
@@ -407,7 +407,7 @@ static class AdditionalSpanHandler extends SpanHandler {
407407
}
408408

409409
@Configuration(proxyBeanMethods = false)
410-
private static class CustomConfiguration {
410+
private static final class CustomConfiguration {
411411

412412
@Bean
413413
Tracing customTracing() {

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/MicrometerTracingAutoConfigurationTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 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.
@@ -123,7 +123,7 @@ void shouldNotSupplyBeansIfTracingIsDisabled() {
123123
}
124124

125125
@Configuration(proxyBeanMethods = false)
126-
private static class TracerConfiguration {
126+
private static final class TracerConfiguration {
127127

128128
@Bean
129129
Tracer tracer() {
@@ -133,7 +133,7 @@ Tracer tracer() {
133133
}
134134

135135
@Configuration(proxyBeanMethods = false)
136-
private static class PropagatorConfiguration {
136+
private static final class PropagatorConfiguration {
137137

138138
@Bean
139139
Propagator propagator() {
@@ -143,7 +143,7 @@ Propagator propagator() {
143143
}
144144

145145
@Configuration(proxyBeanMethods = false)
146-
private static class CustomConfiguration {
146+
private static final class CustomConfiguration {
147147

148148
@Bean
149149
DefaultTracingObservationHandler customDefaultTracingObservationHandler() {

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/OpenTelemetryAutoConfigurationTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 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.
@@ -268,7 +268,7 @@ void shouldCustomizeSdkTracerProvider() {
268268
}
269269

270270
@Configuration(proxyBeanMethods = false)
271-
private static class CustomConfiguration {
271+
private static final class CustomConfiguration {
272272

273273
@Bean
274274
io.micrometer.tracing.Tracer customMicrometerTracer() {
@@ -343,7 +343,7 @@ SpanCustomizer customSpanCustomizer() {
343343
}
344344

345345
@Configuration(proxyBeanMethods = false)
346-
private static class SdkTracerProviderCustomizationConfiguration {
346+
private static final class SdkTracerProviderCustomizationConfiguration {
347347

348348
@Bean
349349
@Order(1)
@@ -366,7 +366,7 @@ SdkTracerProviderBuilderCustomizer sdkTracerProviderBuilderCustomizerTwo() {
366366
}
367367

368368
@Configuration(proxyBeanMethods = false)
369-
private static class InMemoryRecordingSpanExporterConfiguration {
369+
private static final class InMemoryRecordingSpanExporterConfiguration {
370370

371371
@Bean
372372
InMemoryRecordingSpanExporter spanExporter() {
@@ -375,7 +375,7 @@ InMemoryRecordingSpanExporter spanExporter() {
375375

376376
}
377377

378-
private static class InMemoryRecordingSpanExporter implements SpanExporter {
378+
private static final class InMemoryRecordingSpanExporter implements SpanExporter {
379379

380380
private final List<SpanData> exportedSpans = new ArrayList<>();
381381

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/otlp/OtlpAutoConfigurationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 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.
@@ -90,7 +90,7 @@ void shouldBackOffWhenCustomGrpcExporterIsDefined() {
9090
}
9191

9292
@Configuration(proxyBeanMethods = false)
93-
private static class CustomHttpExporterConfiguration {
93+
private static final class CustomHttpExporterConfiguration {
9494

9595
@Bean
9696
OtlpHttpSpanExporter customOtlpHttpSpanExporter() {
@@ -100,7 +100,7 @@ OtlpHttpSpanExporter customOtlpHttpSpanExporter() {
100100
}
101101

102102
@Configuration(proxyBeanMethods = false)
103-
private static class CustomGrpcExporterConfiguration {
103+
private static final class CustomGrpcExporterConfiguration {
104104

105105
@Bean
106106
OtlpGrpcSpanExporter customOtlpGrpcSpanExporter() {

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/prometheus/PrometheusExemplarsAutoConfigurationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 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.
@@ -93,7 +93,7 @@ void prometheusOpenMetricsOutputShouldContainExemplars() {
9393
}
9494

9595
@Configuration(proxyBeanMethods = false)
96-
private static class CustomConfiguration {
96+
private static final class CustomConfiguration {
9797

9898
static final SpanContextSupplier SUPPLIER = mock(SpanContextSupplier.class);
9999

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/wavefront/WavefrontTracingAutoConfigurationTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 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.
@@ -173,7 +173,7 @@ void shouldBackOffOnCustomBeans() {
173173
}
174174

175175
@Configuration(proxyBeanMethods = false)
176-
private static class CustomConfiguration {
176+
private static final class CustomConfiguration {
177177

178178
@Bean
179179
ApplicationTags customApplicationTags() {
@@ -203,7 +203,7 @@ WavefrontOtelSpanExporter customWavefrontOtelSpanExporter() {
203203
}
204204

205205
@Configuration(proxyBeanMethods = false)
206-
private static class WavefrontSenderConfiguration {
206+
private static final class WavefrontSenderConfiguration {
207207

208208
@Bean
209209
WavefrontSender wavefrontSender() {
@@ -213,7 +213,7 @@ WavefrontSender wavefrontSender() {
213213
}
214214

215215
@Configuration(proxyBeanMethods = false)
216-
private static class MeterRegistryConfiguration {
216+
private static final class MeterRegistryConfiguration {
217217

218218
@Bean
219219
MeterRegistry meterRegistry() {

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/zipkin/ZipkinAutoConfigurationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 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.
@@ -93,7 +93,7 @@ void shouldWorkWithoutSenders() {
9393
}
9494

9595
@Configuration(proxyBeanMethods = false)
96-
private static class CustomConfiguration {
96+
private static final class CustomConfiguration {
9797

9898
@Bean
9999
BytesEncoder<Span> customBytesEncoder() {

0 commit comments

Comments
 (0)