Skip to content

Commit 76bc93a

Browse files
committed
Execute OpenRewrite recipes
This executed: ``` mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-migrate-java:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.jspecify.MigrateFromSpringFrameworkAnnotations,org.openrewrite.staticanalysis.AnnotateNullableMethods,org.openrewrite.staticanalysis.NullableOnMethodReturnType -Drewrite.exportDatatables=true ``` Signed-off-by: Stefano Cordio <stefano.cordio@gmail.com>
1 parent b54309b commit 76bc93a

File tree

291 files changed

+947
-932
lines changed

Some content is hidden

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

291 files changed

+947
-932
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/Job.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
*/
1616
package org.springframework.batch.core;
1717

18+
import org.jspecify.annotations.Nullable;
19+
1820
import org.springframework.batch.core.job.DefaultJobParametersValidator;
19-
import org.springframework.lang.Nullable;
2021

2122
/**
2223
* Batch domain object representing a job. {@code Job} is an explicit abstraction
@@ -55,8 +56,7 @@ default boolean isRestartable() {
5556
* @return an incrementer to be used for creating new parameters. Defaults to
5657
* {@code null}.
5758
*/
58-
@Nullable
59-
default JobParametersIncrementer getJobParametersIncrementer() {
59+
default @Nullable JobParametersIncrementer getJobParametersIncrementer() {
6060
return null;
6161
}
6262

spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
import java.util.concurrent.CopyOnWriteArrayList;
3030

3131
import org.springframework.batch.item.ExecutionContext;
32-
import org.springframework.lang.Nullable;
32+
33+
import org.jspecify.annotations.Nullable;
3334

3435
/**
3536
* Batch domain object representing the execution of a job.
@@ -138,8 +139,7 @@ public JobParameters getJobParameters() {
138139
/**
139140
* @return The current end time.
140141
*/
141-
@Nullable
142-
public LocalDateTime getEndTime() {
142+
public @Nullable LocalDateTime getEndTime() {
143143
return endTime;
144144
}
145145

@@ -162,8 +162,7 @@ public void setEndTime(LocalDateTime endTime) {
162162
/**
163163
* @return The current start time.
164164
*/
165-
@Nullable
166-
public LocalDateTime getStartTime() {
165+
public @Nullable LocalDateTime getStartTime() {
167166
return startTime;
168167
}
169168

@@ -205,7 +204,7 @@ public void upgradeStatus(BatchStatus status) {
205204
* implementations.
206205
* @return the {@code id} of the enclosing job.
207206
*/
208-
public Long getJobId() {
207+
public @Nullable Long getJobId() {
209208
if (jobInstance != null) {
210209
return jobInstance.getId();
211210
}
@@ -316,8 +315,7 @@ void addStepExecution(StepExecution stepExecution) {
316315
* @return a {@link LocalDateTime} object representing the last time this
317316
* {@code JobExecution} was updated.
318317
*/
319-
@Nullable
320-
public LocalDateTime getLastUpdated() {
318+
public @Nullable LocalDateTime getLastUpdated() {
321319
return lastUpdated;
322320
}
323321

spring-batch-core/src/main/java/org/springframework/batch/core/JobParameter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818

1919
import java.io.Serializable;
2020

21-
import org.springframework.lang.NonNull;
2221
import org.springframework.util.Assert;
2322

23+
import org.jspecify.annotations.NonNull;
24+
2425
/**
2526
* Domain representation of a parameter to a batch job. The identifying flag is used to
2627
* indicate if the parameter is to be used as part of the identification of a job

spring-batch-core/src/main/java/org/springframework/batch/core/JobParameters.java

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@
2727
import java.util.List;
2828
import java.util.Map;
2929

30-
import org.springframework.lang.Nullable;
3130
import org.springframework.util.Assert;
3231

32+
import org.jspecify.annotations.Nullable;
33+
3334
/**
3435
* Value object representing runtime parameters to a batch job. Because the parameters
3536
* have no individual meaning outside of the {@code JobParameters} object they are
@@ -73,8 +74,7 @@ public JobParameters(Map<String, JobParameter<?>> parameters) {
7374
* @param key The key for which to get a value.
7475
* @return The {@link Long} value or {@code null} if the key is absent.
7576
*/
76-
@Nullable
77-
public Long getLong(String key) {
77+
public @Nullable Long getLong(String key) {
7878
if (!parameters.containsKey(key)) {
7979
return null;
8080
}
@@ -93,8 +93,7 @@ public Long getLong(String key) {
9393
* @return the parameter represented by the provided key or, if that is missing, the
9494
* default value.
9595
*/
96-
@Nullable
97-
public Long getLong(String key, @Nullable Long defaultValue) {
96+
public @Nullable Long getLong(String key, @Nullable Long defaultValue) {
9897
if (parameters.containsKey(key)) {
9998
return getLong(key);
10099
}
@@ -108,8 +107,7 @@ public Long getLong(String key, @Nullable Long defaultValue) {
108107
* @param key The key for which to get a value.
109108
* @return The {@link String} value or {@code null} if the key is absent.
110109
*/
111-
@Nullable
112-
public String getString(String key) {
110+
public @Nullable String getString(String key) {
113111
if (!parameters.containsKey(key)) {
114112
return null;
115113
}
@@ -128,8 +126,7 @@ public String getString(String key) {
128126
* @return the parameter represented by the provided key or, if that is missing, the
129127
* default value.
130128
*/
131-
@Nullable
132-
public String getString(String key, @Nullable String defaultValue) {
129+
public @Nullable String getString(String key, @Nullable String defaultValue) {
133130
if (parameters.containsKey(key)) {
134131
return getString(key);
135132
}
@@ -143,8 +140,7 @@ public String getString(String key, @Nullable String defaultValue) {
143140
* @param key The key for which to get a value.
144141
* @return The {@link Double} value or {@code null} if the key is absent.
145142
*/
146-
@Nullable
147-
public Double getDouble(String key) {
143+
public @Nullable Double getDouble(String key) {
148144
if (!parameters.containsKey(key)) {
149145
return null;
150146
}
@@ -163,8 +159,7 @@ public Double getDouble(String key) {
163159
* @return the parameter represented by the provided key or, if that is missing, the
164160
* default value.
165161
*/
166-
@Nullable
167-
public Double getDouble(String key, @Nullable Double defaultValue) {
162+
public @Nullable Double getDouble(String key, @Nullable Double defaultValue) {
168163
if (parameters.containsKey(key)) {
169164
return getDouble(key);
170165
}
@@ -178,8 +173,7 @@ public Double getDouble(String key, @Nullable Double defaultValue) {
178173
* @param key The key for which to get a value.
179174
* @return the {@link java.util.Date} value or {@code null} if the key is absent.
180175
*/
181-
@Nullable
182-
public Date getDate(String key) {
176+
public @Nullable Date getDate(String key) {
183177
if (!parameters.containsKey(key)) {
184178
return null;
185179
}
@@ -198,8 +192,7 @@ public Date getDate(String key) {
198192
* @return the parameter represented by the provided key or, if that is missing, the
199193
* default value.
200194
*/
201-
@Nullable
202-
public Date getDate(String key, @Nullable Date defaultValue) {
195+
public @Nullable Date getDate(String key, @Nullable Date defaultValue) {
203196
if (parameters.containsKey(key)) {
204197
return getDate(key);
205198
}
@@ -213,8 +206,7 @@ public Date getDate(String key, @Nullable Date defaultValue) {
213206
* @param key The key for which to get a value.
214207
* @return the {@link LocalDate} value or {@code null} if the key is absent.
215208
*/
216-
@Nullable
217-
public LocalDate getLocalDate(String key) {
209+
public @Nullable LocalDate getLocalDate(String key) {
218210
if (!parameters.containsKey(key)) {
219211
return null;
220212
}
@@ -233,8 +225,7 @@ public LocalDate getLocalDate(String key) {
233225
* @return the parameter represented by the provided key or, if that is missing, the
234226
* default value.
235227
*/
236-
@Nullable
237-
public LocalDate getLocalDate(String key, @Nullable LocalDate defaultValue) {
228+
public @Nullable LocalDate getLocalDate(String key, @Nullable LocalDate defaultValue) {
238229
if (parameters.containsKey(key)) {
239230
return getLocalDate(key);
240231
}
@@ -248,8 +239,7 @@ public LocalDate getLocalDate(String key, @Nullable LocalDate defaultValue) {
248239
* @param key The key for which to get a value.
249240
* @return the {@link LocalTime} value or {@code null} if the key is absent.
250241
*/
251-
@Nullable
252-
public LocalTime getLocalTime(String key) {
242+
public @Nullable LocalTime getLocalTime(String key) {
253243
if (!parameters.containsKey(key)) {
254244
return null;
255245
}
@@ -268,8 +258,7 @@ public LocalTime getLocalTime(String key) {
268258
* @return the parameter represented by the provided key or, if that is missing, the
269259
* default value.
270260
*/
271-
@Nullable
272-
public LocalTime getLocalTime(String key, @Nullable LocalTime defaultValue) {
261+
public @Nullable LocalTime getLocalTime(String key, @Nullable LocalTime defaultValue) {
273262
if (parameters.containsKey(key)) {
274263
return getLocalTime(key);
275264
}
@@ -283,8 +272,7 @@ public LocalTime getLocalTime(String key, @Nullable LocalTime defaultValue) {
283272
* @param key The key for which to get a value.
284273
* @return the {@link LocalDateTime} value or {@code null} if the key is absent.
285274
*/
286-
@Nullable
287-
public LocalDateTime getLocalDateTime(String key) {
275+
public @Nullable LocalDateTime getLocalDateTime(String key) {
288276
if (!parameters.containsKey(key)) {
289277
return null;
290278
}
@@ -303,8 +291,7 @@ public LocalDateTime getLocalDateTime(String key) {
303291
* @return the parameter represented by the provided key or, if that is missing, the
304292
* default value.
305293
*/
306-
@Nullable
307-
public LocalDateTime getLocalDateTime(String key, @Nullable LocalDateTime defaultValue) {
294+
public @Nullable LocalDateTime getLocalDateTime(String key, @Nullable LocalDateTime defaultValue) {
308295
if (parameters.containsKey(key)) {
309296
return getLocalDateTime(key);
310297
}
@@ -313,8 +300,7 @@ public LocalDateTime getLocalDateTime(String key, @Nullable LocalDateTime defaul
313300
}
314301
}
315302

316-
@Nullable
317-
public JobParameter<?> getParameter(String key) {
303+
public @Nullable JobParameter<?> getParameter(String key) {
318304
Assert.notNull(key, "key must not be null");
319305
return parameters.get(key);
320306
}

spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
import java.util.Map;
2525

2626
import org.springframework.batch.core.repository.explore.JobExplorer;
27-
import org.springframework.lang.NonNull;
27+
28+
import org.jspecify.annotations.NonNull;
2829
import org.springframework.util.Assert;
2930

3031
/**

spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersIncrementer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
package org.springframework.batch.core;
1717

18-
import org.springframework.lang.Nullable;
18+
import org.jspecify.annotations.Nullable;
1919

2020
/**
2121
* Interface for obtaining the next {@link JobParameters} object in a sequence.

spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
package org.springframework.batch.core;
1717

18-
import org.springframework.lang.Nullable;
18+
import org.jspecify.annotations.Nullable;
1919

2020
/**
2121
* Strategy interface for a {@link Job} to use in validating its parameters for an

spring-batch-core/src/main/java/org/springframework/batch/core/SpringBatchVersion.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
package org.springframework.batch.core;
1717

18-
import org.springframework.lang.Nullable;
18+
import org.jspecify.annotations.Nullable;
1919

2020
/**
2121
* Class that exposes the Spring Batch version. Fetches the "Implementation-Version"
@@ -43,8 +43,7 @@ private SpringBatchVersion() {
4343
* {@code "N/A"} if it cannot be determined.
4444
* @see Package#getImplementationVersion()
4545
*/
46-
@Nullable
47-
public static String getVersion() {
46+
public static @Nullable String getVersion() {
4847
Package pkg = SpringBatchVersion.class.getPackage();
4948
if (pkg != null && pkg.getImplementationVersion() != null) {
5049
return pkg.getImplementationVersion();

spring-batch-core/src/main/java/org/springframework/batch/core/StepExecution.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
import java.util.concurrent.CopyOnWriteArrayList;
2525

2626
import org.springframework.batch.item.ExecutionContext;
27-
import org.springframework.lang.Nullable;
27+
28+
import org.jspecify.annotations.Nullable;
2829
import org.springframework.util.Assert;
2930

3031
/**
@@ -154,8 +155,7 @@ public void setCommitCount(long commitCount) {
154155
* Returns the time when this execution ended or {@code null} if the step is running.
155156
* @return the time when this execution ended or {@code null} if the step is running.
156157
*/
157-
@Nullable
158-
public LocalDateTime getEndTime() {
158+
public @Nullable LocalDateTime getEndTime() {
159159
return endTime;
160160
}
161161

@@ -251,8 +251,7 @@ public void setCreateTime(LocalDateTime createTime) {
251251
* Gets the time when this execution started.
252252
* @return the time when this execution started.
253253
*/
254-
@Nullable
255-
public LocalDateTime getStartTime() {
254+
public @Nullable LocalDateTime getStartTime() {
256255
return startTime;
257256
}
258257

@@ -301,7 +300,7 @@ public String getStepName() {
301300
* Accessor for the job execution ID.
302301
* @return the {@code jobExecutionId}.
303302
*/
304-
public Long getJobExecutionId() {
303+
public @Nullable Long getJobExecutionId() {
305304
if (jobExecution != null) {
306305
return jobExecution.getId();
307306
}
@@ -455,8 +454,7 @@ public void setProcessSkipCount(long processSkipCount) {
455454
/**
456455
* @return the Date representing the last time this execution was persisted.
457456
*/
458-
@Nullable
459-
public LocalDateTime getLastUpdated() {
457+
public @Nullable LocalDateTime getLastUpdated() {
460458
return lastUpdated;
461459
}
462460

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/JobLocator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
*/
1616
package org.springframework.batch.core.configuration;
1717

18+
import org.jspecify.annotations.Nullable;
19+
1820
import org.springframework.batch.core.Job;
1921
import org.springframework.batch.core.launch.NoSuchJobException;
20-
import org.springframework.lang.Nullable;
2122

2223
/**
2324
* A runtime service locator interface for retrieving job configurations by

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultJobLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import org.apache.commons.logging.Log;
2525
import org.apache.commons.logging.LogFactory;
26+
import org.jspecify.annotations.Nullable;
2627

2728
import org.springframework.batch.core.Job;
2829
import org.springframework.batch.core.Step;
@@ -34,7 +35,6 @@
3435
import org.springframework.beans.factory.InitializingBean;
3536
import org.springframework.context.ApplicationContext;
3637
import org.springframework.context.ConfigurableApplicationContext;
37-
import org.springframework.lang.Nullable;
3838
import org.springframework.util.Assert;
3939

4040
/**

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/GroupAwareJob.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
*/
1616
package org.springframework.batch.core.configuration.support;
1717

18+
import org.jspecify.annotations.Nullable;
19+
1820
import org.springframework.batch.core.Job;
1921
import org.springframework.batch.core.JobExecution;
2022
import org.springframework.batch.core.JobParametersIncrementer;
2123
import org.springframework.batch.core.JobParametersValidator;
22-
import org.springframework.lang.Nullable;
2324
import org.springframework.util.ClassUtils;
2425

2526
/**
@@ -87,8 +88,7 @@ public boolean isRestartable() {
8788
}
8889

8990
@Override
90-
@Nullable
91-
public JobParametersIncrementer getJobParametersIncrementer() {
91+
public @Nullable JobParametersIncrementer getJobParametersIncrementer() {
9292
return delegate.getJobParametersIncrementer();
9393
}
9494

0 commit comments

Comments
 (0)