Skip to content

Commit 5f666ee

Browse files
committed
Reduce warnings reported by Eclipse
Closes gh-41598
1 parent f9f530d commit 5f666ee

File tree

31 files changed

+154
-141
lines changed

31 files changed

+154
-141
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/BravePropagationConfigurations.java

Lines changed: 2 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.
@@ -30,7 +30,6 @@
3030
import brave.propagation.CurrentTraceContext.ScopeDecorator;
3131
import brave.propagation.Propagation;
3232
import brave.propagation.Propagation.Factory;
33-
import brave.propagation.Propagation.KeyFactory;
3433

3534
import org.springframework.beans.factory.ObjectProvider;
3635
import org.springframework.boot.actuate.autoconfigure.tracing.TracingProperties.Baggage.Correlation;
@@ -102,7 +101,7 @@ private Factory createThrowAwayFactory() {
102101
return new Factory() {
103102

104103
@Override
105-
public <K> Propagation<K> create(KeyFactory<K> keyFactory) {
104+
public <K> Propagation<K> create(brave.propagation.Propagation.KeyFactory<K> keyFactory) {
106105
return null;
107106
}
108107

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

Lines changed: 2 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.
@@ -22,7 +22,6 @@
2222
import brave.baggage.BaggagePropagationConfig;
2323
import brave.propagation.Propagation;
2424
import brave.propagation.Propagation.Factory;
25-
import brave.propagation.Propagation.KeyFactory;
2625
import org.junit.jupiter.api.Test;
2726

2827
import static org.assertj.core.api.Assertions.assertThat;
@@ -54,7 +53,7 @@ void empty() {
5453
private static FactoryBuilder createBuilder() {
5554
return BaggagePropagation.newFactoryBuilder(new Factory() {
5655
@Override
57-
public <K> Propagation<K> create(KeyFactory<K> keyFactory) {
56+
public <K> Propagation<K> create(brave.propagation.Propagation.KeyFactory<K> keyFactory) {
5857
return null;
5958
}
6059
});

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/zipkin/ZipkinHttpSenderTests.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.
@@ -48,7 +48,7 @@ abstract class ZipkinHttpSenderTests {
4848
abstract Sender createSender();
4949

5050
@BeforeEach
51-
void beforeEach() throws Exception {
51+
void beforeEach() {
5252
this.sender = createSender();
5353
}
5454

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

Lines changed: 10 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.
@@ -72,7 +72,7 @@ static void afterAll() throws IOException {
7272

7373
@Override
7474
@BeforeEach
75-
void beforeEach() throws Exception {
75+
void beforeEach() {
7676
super.beforeEach();
7777
clearResponses();
7878
clearRequests();
@@ -175,10 +175,16 @@ private void requestAssertions(Consumer<RecordedRequest> assertions) throws Inte
175175
assertThat(request).satisfies(assertions);
176176
}
177177

178-
private static void clearRequests() throws InterruptedException {
178+
private static void clearRequests() {
179179
RecordedRequest request;
180180
do {
181-
request = mockBackEnd.takeRequest(0, TimeUnit.SECONDS);
181+
try {
182+
request = mockBackEnd.takeRequest(0, TimeUnit.SECONDS);
183+
}
184+
catch (InterruptedException ex) {
185+
Thread.currentThread().interrupt();
186+
throw new RuntimeException(ex);
187+
}
182188
}
183189
while (request != null);
184190
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import org.springframework.boot.context.properties.EnableConfigurationProperties;
4444
import org.springframework.boot.context.properties.PropertyMapper;
4545
import org.springframework.boot.context.properties.source.MutuallyExclusiveConfigurationPropertiesException;
46-
import org.springframework.boot.task.TaskSchedulerBuilder;
4746
import org.springframework.boot.task.ThreadPoolTaskSchedulerBuilder;
4847
import org.springframework.context.annotation.Bean;
4948
import org.springframework.context.annotation.Conditional;
@@ -171,13 +170,14 @@ private Trigger createPeriodicTrigger(Duration period, Duration initialDelay, bo
171170
* scheduling explicitly.
172171
*/
173172
@Configuration(proxyBeanMethods = false)
174-
@ConditionalOnBean(TaskSchedulerBuilder.class)
173+
@ConditionalOnBean(org.springframework.boot.task.TaskSchedulerBuilder.class)
175174
@ConditionalOnMissingBean(name = IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME)
176-
@SuppressWarnings("removal")
175+
@SuppressWarnings({ "deprecation", "removal" })
177176
protected static class IntegrationTaskSchedulerConfiguration {
178177

179178
@Bean(name = IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME)
180-
public ThreadPoolTaskScheduler taskScheduler(TaskSchedulerBuilder taskSchedulerBuilder,
179+
public ThreadPoolTaskScheduler taskScheduler(
180+
org.springframework.boot.task.TaskSchedulerBuilder taskSchedulerBuilder,
181181
ObjectProvider<ThreadPoolTaskSchedulerBuilder> threadPoolTaskSchedulerBuilderProvider) {
182182
ThreadPoolTaskSchedulerBuilder threadPoolTaskSchedulerBuilder = threadPoolTaskSchedulerBuilderProvider
183183
.getIfUnique();

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutorConfigurations.java

Lines changed: 13 additions & 12 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.
@@ -24,8 +24,6 @@
2424
import org.springframework.boot.autoconfigure.thread.Threading;
2525
import org.springframework.boot.task.SimpleAsyncTaskExecutorBuilder;
2626
import org.springframework.boot.task.SimpleAsyncTaskExecutorCustomizer;
27-
import org.springframework.boot.task.TaskExecutorBuilder;
28-
import org.springframework.boot.task.TaskExecutorCustomizer;
2927
import org.springframework.boot.task.ThreadPoolTaskExecutorBuilder;
3028
import org.springframework.boot.task.ThreadPoolTaskExecutorCustomizer;
3129
import org.springframework.context.annotation.Bean;
@@ -48,7 +46,6 @@ class TaskExecutorConfigurations {
4846

4947
@Configuration(proxyBeanMethods = false)
5048
@ConditionalOnMissingBean(Executor.class)
51-
@SuppressWarnings("removal")
5249
static class TaskExecutorConfiguration {
5350

5451
@Bean(name = { TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME,
@@ -62,7 +59,9 @@ SimpleAsyncTaskExecutor applicationTaskExecutorVirtualThreads(SimpleAsyncTaskExe
6259
@Bean(name = { TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME,
6360
AsyncAnnotationBeanPostProcessor.DEFAULT_TASK_EXECUTOR_BEAN_NAME })
6461
@ConditionalOnThreading(Threading.PLATFORM)
65-
ThreadPoolTaskExecutor applicationTaskExecutor(TaskExecutorBuilder taskExecutorBuilder,
62+
@SuppressWarnings({ "deprecation", "removal" })
63+
ThreadPoolTaskExecutor applicationTaskExecutor(
64+
org.springframework.boot.task.TaskExecutorBuilder taskExecutorBuilder,
6665
ObjectProvider<ThreadPoolTaskExecutorBuilder> threadPoolTaskExecutorBuilderProvider) {
6766
ThreadPoolTaskExecutorBuilder threadPoolTaskExecutorBuilder = threadPoolTaskExecutorBuilderProvider
6867
.getIfUnique();
@@ -81,11 +80,11 @@ static class TaskExecutorBuilderConfiguration {
8180
@Bean
8281
@ConditionalOnMissingBean
8382
@Deprecated(since = "3.2.0", forRemoval = true)
84-
TaskExecutorBuilder taskExecutorBuilder(TaskExecutionProperties properties,
85-
ObjectProvider<TaskExecutorCustomizer> taskExecutorCustomizers,
83+
org.springframework.boot.task.TaskExecutorBuilder taskExecutorBuilder(TaskExecutionProperties properties,
84+
ObjectProvider<org.springframework.boot.task.TaskExecutorCustomizer> taskExecutorCustomizers,
8685
ObjectProvider<TaskDecorator> taskDecorator) {
8786
TaskExecutionProperties.Pool pool = properties.getPool();
88-
TaskExecutorBuilder builder = new TaskExecutorBuilder();
87+
org.springframework.boot.task.TaskExecutorBuilder builder = new org.springframework.boot.task.TaskExecutorBuilder();
8988
builder = builder.queueCapacity(pool.getQueueCapacity());
9089
builder = builder.corePoolSize(pool.getCoreSize());
9190
builder = builder.maxPoolSize(pool.getMaxSize());
@@ -103,14 +102,15 @@ TaskExecutorBuilder taskExecutorBuilder(TaskExecutionProperties properties,
103102
}
104103

105104
@Configuration(proxyBeanMethods = false)
106-
@SuppressWarnings("removal")
105+
@SuppressWarnings({ "deprecation", "removal" })
107106
static class ThreadPoolTaskExecutorBuilderConfiguration {
108107

109108
@Bean
110-
@ConditionalOnMissingBean({ TaskExecutorBuilder.class, ThreadPoolTaskExecutorBuilder.class })
109+
@ConditionalOnMissingBean({ org.springframework.boot.task.TaskExecutorBuilder.class,
110+
ThreadPoolTaskExecutorBuilder.class })
111111
ThreadPoolTaskExecutorBuilder threadPoolTaskExecutorBuilder(TaskExecutionProperties properties,
112112
ObjectProvider<ThreadPoolTaskExecutorCustomizer> threadPoolTaskExecutorCustomizers,
113-
ObjectProvider<TaskExecutorCustomizer> taskExecutorCustomizers,
113+
ObjectProvider<org.springframework.boot.task.TaskExecutorCustomizer> taskExecutorCustomizers,
114114
ObjectProvider<TaskDecorator> taskDecorator) {
115115
TaskExecutionProperties.Pool pool = properties.getPool();
116116
ThreadPoolTaskExecutorBuilder builder = new ThreadPoolTaskExecutorBuilder();
@@ -130,7 +130,8 @@ ThreadPoolTaskExecutorBuilder threadPoolTaskExecutorBuilder(TaskExecutionPropert
130130
return builder;
131131
}
132132

133-
private ThreadPoolTaskExecutorCustomizer adapt(TaskExecutorCustomizer customizer) {
133+
private ThreadPoolTaskExecutorCustomizer adapt(
134+
org.springframework.boot.task.TaskExecutorCustomizer customizer) {
134135
return customizer::customize;
135136
}
136137

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingConfigurations.java

Lines changed: 13 additions & 13 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.
@@ -25,8 +25,6 @@
2525
import org.springframework.boot.autoconfigure.thread.Threading;
2626
import org.springframework.boot.task.SimpleAsyncTaskSchedulerBuilder;
2727
import org.springframework.boot.task.SimpleAsyncTaskSchedulerCustomizer;
28-
import org.springframework.boot.task.TaskSchedulerBuilder;
29-
import org.springframework.boot.task.TaskSchedulerCustomizer;
3028
import org.springframework.boot.task.ThreadPoolTaskSchedulerBuilder;
3129
import org.springframework.boot.task.ThreadPoolTaskSchedulerCustomizer;
3230
import org.springframework.context.annotation.Bean;
@@ -47,7 +45,6 @@ class TaskSchedulingConfigurations {
4745
@Configuration(proxyBeanMethods = false)
4846
@ConditionalOnBean(name = TaskManagementConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME)
4947
@ConditionalOnMissingBean({ TaskScheduler.class, ScheduledExecutorService.class })
50-
@SuppressWarnings("removal")
5148
static class TaskSchedulerConfiguration {
5249

5350
@Bean(name = "taskScheduler")
@@ -57,8 +54,9 @@ SimpleAsyncTaskScheduler taskSchedulerVirtualThreads(SimpleAsyncTaskSchedulerBui
5754
}
5855

5956
@Bean
57+
@SuppressWarnings({ "deprecation", "removal" })
6058
@ConditionalOnThreading(Threading.PLATFORM)
61-
ThreadPoolTaskScheduler taskScheduler(TaskSchedulerBuilder taskSchedulerBuilder,
59+
ThreadPoolTaskScheduler taskScheduler(org.springframework.boot.task.TaskSchedulerBuilder taskSchedulerBuilder,
6260
ObjectProvider<ThreadPoolTaskSchedulerBuilder> threadPoolTaskSchedulerBuilderProvider) {
6361
ThreadPoolTaskSchedulerBuilder threadPoolTaskSchedulerBuilder = threadPoolTaskSchedulerBuilderProvider
6462
.getIfUnique();
@@ -71,14 +69,14 @@ ThreadPoolTaskScheduler taskScheduler(TaskSchedulerBuilder taskSchedulerBuilder,
7169
}
7270

7371
@Configuration(proxyBeanMethods = false)
74-
@SuppressWarnings("removal")
72+
@SuppressWarnings({ "deprecation", "removal" })
7573
static class TaskSchedulerBuilderConfiguration {
7674

7775
@Bean
7876
@ConditionalOnMissingBean
79-
TaskSchedulerBuilder taskSchedulerBuilder(TaskSchedulingProperties properties,
80-
ObjectProvider<TaskSchedulerCustomizer> taskSchedulerCustomizers) {
81-
TaskSchedulerBuilder builder = new TaskSchedulerBuilder();
77+
org.springframework.boot.task.TaskSchedulerBuilder taskSchedulerBuilder(TaskSchedulingProperties properties,
78+
ObjectProvider<org.springframework.boot.task.TaskSchedulerCustomizer> taskSchedulerCustomizers) {
79+
org.springframework.boot.task.TaskSchedulerBuilder builder = new org.springframework.boot.task.TaskSchedulerBuilder();
8280
builder = builder.poolSize(properties.getPool().getSize());
8381
TaskSchedulingProperties.Shutdown shutdown = properties.getShutdown();
8482
builder = builder.awaitTermination(shutdown.isAwaitTermination());
@@ -91,14 +89,15 @@ TaskSchedulerBuilder taskSchedulerBuilder(TaskSchedulingProperties properties,
9189
}
9290

9391
@Configuration(proxyBeanMethods = false)
94-
@SuppressWarnings("removal")
92+
@SuppressWarnings({ "deprecation", "removal" })
9593
static class ThreadPoolTaskSchedulerBuilderConfiguration {
9694

9795
@Bean
98-
@ConditionalOnMissingBean({ TaskSchedulerBuilder.class, ThreadPoolTaskSchedulerBuilder.class })
96+
@ConditionalOnMissingBean({ org.springframework.boot.task.TaskSchedulerBuilder.class,
97+
ThreadPoolTaskSchedulerBuilder.class })
9998
ThreadPoolTaskSchedulerBuilder threadPoolTaskSchedulerBuilder(TaskSchedulingProperties properties,
10099
ObjectProvider<ThreadPoolTaskSchedulerCustomizer> threadPoolTaskSchedulerCustomizers,
101-
ObjectProvider<TaskSchedulerCustomizer> taskSchedulerCustomizers) {
100+
ObjectProvider<org.springframework.boot.task.TaskSchedulerCustomizer> taskSchedulerCustomizers) {
102101
TaskSchedulingProperties.Shutdown shutdown = properties.getShutdown();
103102
ThreadPoolTaskSchedulerBuilder builder = new ThreadPoolTaskSchedulerBuilder();
104103
builder = builder.poolSize(properties.getPool().getSize());
@@ -111,7 +110,8 @@ ThreadPoolTaskSchedulerBuilder threadPoolTaskSchedulerBuilder(TaskSchedulingProp
111110
return builder;
112111
}
113112

114-
private ThreadPoolTaskSchedulerCustomizer adapt(TaskSchedulerCustomizer customizer) {
113+
private ThreadPoolTaskSchedulerCustomizer adapt(
114+
org.springframework.boot.task.TaskSchedulerCustomizer customizer) {
115115
return customizer::customize;
116116
}
117117

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/client/RestClientAutoConfiguration.java

Lines changed: 5 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.
@@ -35,13 +35,14 @@
3535
import org.springframework.core.Ordered;
3636
import org.springframework.core.annotation.Order;
3737
import org.springframework.web.client.RestClient;
38+
import org.springframework.web.client.RestClient.Builder;
3839

3940
/**
4041
* {@link EnableAutoConfiguration Auto-configuration} for {@link RestClient}.
4142
* <p>
42-
* This will produce a {@link RestClient.Builder RestClient.Builder} bean with the
43-
* {@code prototype} scope, meaning each injection point will receive a newly cloned
44-
* instance of the builder.
43+
* This will produce a {@link Builder RestClient.Builder} bean with the {@code prototype}
44+
* scope, meaning each injection point will receive a newly cloned instance of the
45+
* builder.
4546
*
4647
* @author Arjen Poutsma
4748
* @author Moritz Halbritter

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/client/RestClientBuilderConfigurer.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.
@@ -23,7 +23,7 @@
2323
import org.springframework.web.client.RestClient.Builder;
2424

2525
/**
26-
* Configure {@link RestClient.Builder} with sensible defaults.
26+
* Configure {@link Builder RestClient.Builder} with sensible defaults.
2727
*
2828
* @author Moritz Halbritter
2929
* @since 3.2.0
@@ -37,9 +37,9 @@ void setRestClientCustomizers(List<RestClientCustomizer> customizers) {
3737
}
3838

3939
/**
40-
* Configure the specified {@link RestClient.Builder}. The builder can be further
41-
* tuned and default settings can be overridden.
42-
* @param builder the {@link RestClient.Builder} instance to configure
40+
* Configure the specified {@link Builder RestClient.Builder}. The builder can be
41+
* further tuned and default settings can be overridden.
42+
* @param builder the {@link Builder RestClient.Builder} instance to configure
4343
* @return the configured builder
4444
*/
4545
public RestClient.Builder configure(RestClient.Builder builder) {

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfigurationTests.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import graphql.schema.GraphQLOutputType;
2828
import graphql.schema.GraphQLSchema;
2929
import graphql.schema.idl.RuntimeWiring;
30-
import graphql.schema.visibility.DefaultGraphqlFieldVisibility;
3130
import org.assertj.core.api.InstanceOfAssertFactories;
3231
import org.junit.jupiter.api.Test;
3332
import org.junit.jupiter.api.extension.ExtendWith;
@@ -169,20 +168,13 @@ void schemaInspectionShouldBeEnabledByDefault(CapturedOutput output) {
169168

170169
@Test
171170
void fieldIntrospectionShouldBeEnabledByDefault() {
172-
this.contextRunner.run((context) -> {
173-
GraphQlSource graphQlSource = context.getBean(GraphQlSource.class);
174-
GraphQLSchema schema = graphQlSource.schema();
175-
assertThat(schema.getCodeRegistry().getFieldVisibility()).isInstanceOf(DefaultGraphqlFieldVisibility.class);
176-
});
171+
this.contextRunner.run((context) -> assertThat(Introspection.isEnabledJvmWide()).isTrue());
177172
}
178173

179174
@Test
180175
void shouldDisableFieldIntrospection() {
181-
this.contextRunner.withPropertyValues("spring.graphql.schema.introspection.enabled:false").run((context) -> {
182-
GraphQlSource graphQlSource = context.getBean(GraphQlSource.class);
183-
GraphQLSchema schema = graphQlSource.schema();
184-
assertThat(Introspection.isEnabledJvmWide()).isFalse();
185-
});
176+
this.contextRunner.withPropertyValues("spring.graphql.schema.introspection.enabled:false")
177+
.run((context) -> assertThat(Introspection.isEnabledJvmWide()).isFalse());
186178
}
187179

188180
@Test

0 commit comments

Comments
 (0)