Skip to content

Commit e87e1f5

Browse files
committed
Remove unnecessary @NonNull
Signed-off-by: Stefano Cordio <[email protected]>
1 parent 5f9dc5b commit e87e1f5

File tree

12 files changed

+38
-50
lines changed

12 files changed

+38
-50
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/converter/DefaultJobParametersConverter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import org.springframework.batch.core.job.parameters.JobParameter;
2323

24-
import org.jspecify.annotations.NonNull;
2524
import org.jspecify.annotations.Nullable;
2625
import org.springframework.batch.core.job.parameters.JobParameters;
2726
import org.springframework.batch.core.job.parameters.JobParametersBuilder;
@@ -131,7 +130,7 @@ public Properties getProperties(@Nullable JobParameters jobParameters) {
131130
* @param conversionService the conversion service to use. Must not be {@code null}.
132131
* @since 5.0
133132
*/
134-
public void setConversionService(@NonNull ConfigurableConversionService conversionService) {
133+
public void setConversionService(ConfigurableConversionService conversionService) {
135134
Assert.notNull(conversionService, "The conversionService must not be null");
136135
this.conversionService = conversionService;
137136
}

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020

2121
import org.springframework.util.Assert;
2222

23-
import org.jspecify.annotations.NonNull;
24-
2523
/**
2624
* Domain representation of a parameter to a batch job. The identifying flag is used to
2725
* indicate if the parameter is to be used as part of the identification of a job
@@ -49,7 +47,7 @@ public class JobParameter<T> implements Serializable {
4947
* @param type the type of the parameter. Must not be {@code null}.
5048
* @param identifying true if the parameter is identifying. false otherwise.
5149
*/
52-
public JobParameter(@NonNull T value, @NonNull Class<T> type, boolean identifying) {
50+
public JobParameter(T value, Class<T> type, boolean identifying) {
5351
Assert.notNull(value, "value must not be null");
5452
Assert.notNull(type, "type must not be null");
5553
this.value = value;
@@ -62,7 +60,7 @@ public JobParameter(@NonNull T value, @NonNull Class<T> type, boolean identifyin
6260
* @param value the value of the parameter. Must not be {@code null}.
6361
* @param type the type of the parameter. Must not be {@code null}.
6462
*/
65-
public JobParameter(@NonNull T value, @NonNull Class<T> type) {
63+
public JobParameter(T value, Class<T> type) {
6664
this(value, type, true);
6765
}
6866

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

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.springframework.batch.core.job.JobInstance;
2929
import org.springframework.batch.core.repository.explore.JobExplorer;
3030

31-
import org.jspecify.annotations.NonNull;
3231
import org.springframework.util.Assert;
3332

3433
/**
@@ -96,7 +95,7 @@ public JobParametersBuilder(JobParameters jobParameters, JobExplorer jobExplorer
9695
* @param parameter The runtime parameter. Must not be {@code null}.
9796
* @return a reference to this object.
9897
*/
99-
public JobParametersBuilder addString(String key, @NonNull String parameter) {
98+
public JobParametersBuilder addString(String key, String parameter) {
10099
return addString(key, parameter, true);
101100
}
102101

@@ -108,7 +107,7 @@ public JobParametersBuilder addString(String key, @NonNull String parameter) {
108107
* job instance.
109108
* @return a reference to this object.
110109
*/
111-
public JobParametersBuilder addString(String key, @NonNull String parameter, boolean identifying) {
110+
public JobParametersBuilder addString(String key, String parameter, boolean identifying) {
112111
Assert.notNull(parameter, "Value for parameter '" + key + "' must not be null");
113112
this.parameterMap.put(key, new JobParameter<>(parameter, String.class, identifying));
114113
return this;
@@ -120,7 +119,7 @@ public JobParametersBuilder addString(String key, @NonNull String parameter, boo
120119
* @param parameter The runtime parameter. Must not be {@code null}.
121120
* @return a reference to this object.
122121
*/
123-
public JobParametersBuilder addDate(String key, @NonNull Date parameter) {
122+
public JobParametersBuilder addDate(String key, Date parameter) {
124123
return addDate(key, parameter, true);
125124
}
126125

@@ -132,7 +131,7 @@ public JobParametersBuilder addDate(String key, @NonNull Date parameter) {
132131
* instance
133132
* @return a reference to this object.
134133
*/
135-
public JobParametersBuilder addDate(String key, @NonNull Date parameter, boolean identifying) {
134+
public JobParametersBuilder addDate(String key, Date parameter, boolean identifying) {
136135
Assert.notNull(parameter, "Value for parameter '" + key + "' must not be null");
137136
this.parameterMap.put(key, new JobParameter<>(parameter, Date.class, identifying));
138137
return this;
@@ -144,7 +143,7 @@ public JobParametersBuilder addDate(String key, @NonNull Date parameter, boolean
144143
* @param parameter The runtime parameter. Must not be {@code null}.
145144
* @return a reference to this object.
146145
*/
147-
public JobParametersBuilder addLocalDate(String key, @NonNull LocalDate parameter) {
146+
public JobParametersBuilder addLocalDate(String key, LocalDate parameter) {
148147
return addLocalDate(key, parameter, true);
149148
}
150149

@@ -156,7 +155,7 @@ public JobParametersBuilder addLocalDate(String key, @NonNull LocalDate paramete
156155
* instance
157156
* @return a reference to this object.
158157
*/
159-
public JobParametersBuilder addLocalDate(String key, @NonNull LocalDate parameter, boolean identifying) {
158+
public JobParametersBuilder addLocalDate(String key, LocalDate parameter, boolean identifying) {
160159
Assert.notNull(parameter, "Value for parameter '" + key + "' must not be null");
161160
this.parameterMap.put(key, new JobParameter<>(parameter, LocalDate.class, identifying));
162161
return this;
@@ -168,7 +167,7 @@ public JobParametersBuilder addLocalDate(String key, @NonNull LocalDate paramete
168167
* @param parameter The runtime parameter. Must not be {@code null}.
169168
* @return a reference to this object.
170169
*/
171-
public JobParametersBuilder addLocalTime(String key, @NonNull LocalTime parameter) {
170+
public JobParametersBuilder addLocalTime(String key, LocalTime parameter) {
172171
return addLocalTime(key, parameter, true);
173172
}
174173

@@ -180,7 +179,7 @@ public JobParametersBuilder addLocalTime(String key, @NonNull LocalTime paramete
180179
* instance
181180
* @return a reference to this object.
182181
*/
183-
public JobParametersBuilder addLocalTime(String key, @NonNull LocalTime parameter, boolean identifying) {
182+
public JobParametersBuilder addLocalTime(String key, LocalTime parameter, boolean identifying) {
184183
Assert.notNull(parameter, "Value for parameter '" + key + "' must not be null");
185184
this.parameterMap.put(key, new JobParameter<>(parameter, LocalTime.class, identifying));
186185
return this;
@@ -192,7 +191,7 @@ public JobParametersBuilder addLocalTime(String key, @NonNull LocalTime paramete
192191
* @param parameter The runtime parameter. Must not be {@code null}.
193192
* @return a reference to this object.
194193
*/
195-
public JobParametersBuilder addLocalDateTime(String key, @NonNull LocalDateTime parameter) {
194+
public JobParametersBuilder addLocalDateTime(String key, LocalDateTime parameter) {
196195
return addLocalDateTime(key, parameter, true);
197196
}
198197

@@ -204,7 +203,7 @@ public JobParametersBuilder addLocalDateTime(String key, @NonNull LocalDateTime
204203
* instance
205204
* @return a reference to this object.
206205
*/
207-
public JobParametersBuilder addLocalDateTime(String key, @NonNull LocalDateTime parameter, boolean identifying) {
206+
public JobParametersBuilder addLocalDateTime(String key, LocalDateTime parameter, boolean identifying) {
208207
Assert.notNull(parameter, "Value for parameter '" + key + "' must not be null");
209208
this.parameterMap.put(key, new JobParameter<>(parameter, LocalDateTime.class, identifying));
210209
return this;
@@ -216,7 +215,7 @@ public JobParametersBuilder addLocalDateTime(String key, @NonNull LocalDateTime
216215
* @param parameter The runtime parameter. Must not be {@code null}.
217216
* @return a reference to this object.
218217
*/
219-
public JobParametersBuilder addLong(String key, @NonNull Long parameter) {
218+
public JobParametersBuilder addLong(String key, Long parameter) {
220219
return addLong(key, parameter, true);
221220
}
222221

@@ -228,7 +227,7 @@ public JobParametersBuilder addLong(String key, @NonNull Long parameter) {
228227
* instance.
229228
* @return a reference to this object.
230229
*/
231-
public JobParametersBuilder addLong(String key, @NonNull Long parameter, boolean identifying) {
230+
public JobParametersBuilder addLong(String key, Long parameter, boolean identifying) {
232231
Assert.notNull(parameter, "Value for parameter '" + key + "' must not be null");
233232
this.parameterMap.put(key, new JobParameter<>(parameter, Long.class, identifying));
234233
return this;
@@ -240,7 +239,7 @@ public JobParametersBuilder addLong(String key, @NonNull Long parameter, boolean
240239
* @param parameter The runtime parameter. Must not be {@code null}.
241240
* @return a reference to this object.
242241
*/
243-
public JobParametersBuilder addDouble(String key, @NonNull Double parameter) {
242+
public JobParametersBuilder addDouble(String key, Double parameter) {
244243
return addDouble(key, parameter, true);
245244
}
246245

@@ -252,7 +251,7 @@ public JobParametersBuilder addDouble(String key, @NonNull Double parameter) {
252251
* instance.
253252
* @return a reference to this object.
254253
*/
255-
public JobParametersBuilder addDouble(String key, @NonNull Double parameter, boolean identifying) {
254+
public JobParametersBuilder addDouble(String key, Double parameter, boolean identifying) {
256255
Assert.notNull(parameter, "Value for parameter '" + key + "' must not be null");
257256
this.parameterMap.put(key, new JobParameter<>(parameter, Double.class, identifying));
258257
return this;
@@ -289,7 +288,7 @@ public JobParametersBuilder addJobParameter(String key, JobParameter<?> jobParam
289288
* @param <T> the type of the parameter
290289
* @since 5.0
291290
*/
292-
public <T> JobParametersBuilder addJobParameter(String name, @NonNull T value, Class<T> type, boolean identifying) {
291+
public <T> JobParametersBuilder addJobParameter(String name, T value, Class<T> type, boolean identifying) {
293292
Assert.notNull(value, "Value for parameter '" + name + "' must not be null");
294293
return addJobParameter(name, new JobParameter<>(value, type, identifying));
295294
}
@@ -303,7 +302,7 @@ public <T> JobParametersBuilder addJobParameter(String name, @NonNull T value, C
303302
* @param <T> the type of the parameter
304303
* @since 5.0
305304
*/
306-
public <T> JobParametersBuilder addJobParameter(String name, @NonNull T value, Class<T> type) {
305+
public <T> JobParametersBuilder addJobParameter(String name, T value, Class<T> type) {
307306
return addJobParameter(name, value, type, true);
308307
}
309308

spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/jdbc/JdbcExecutionContextDao.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535

3636
import org.springframework.batch.core.job.JobExecution;
3737

38-
import org.jspecify.annotations.NonNull;
3938
import org.springframework.batch.core.step.StepExecution;
4039
import org.springframework.batch.core.repository.ExecutionContextSerializer;
4140
import org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao;
@@ -145,7 +144,7 @@ public void setShortContextLength(int shortContextLength) {
145144
* @param charset to use when serializing/deserializing the execution context.
146145
* @since 5.0
147146
*/
148-
public void setCharset(@NonNull Charset charset) {
147+
public void setCharset(Charset charset) {
149148
Assert.notNull(charset, "Charset must not be null");
150149
this.charset = charset;
151150
}

spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/jdbc/JdbcJobExecutionDao.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
import org.apache.commons.logging.Log;
3434
import org.apache.commons.logging.LogFactory;
35-
import org.jspecify.annotations.NonNull;
3635
import org.jspecify.annotations.Nullable;
3736

3837
import org.springframework.batch.core.BatchStatus;
@@ -196,7 +195,7 @@ public void setJobExecutionIncrementer(DataFieldMaxValueIncrementer jobExecution
196195
* Set the conversion service to use to convert job parameters from String literals to
197196
* typed values and vice versa.
198197
*/
199-
public void setConversionService(@NonNull ConfigurableConversionService conversionService) {
198+
public void setConversionService(ConfigurableConversionService conversionService) {
200199
Assert.notNull(conversionService, "conversionService must not be null");
201200
this.conversionService = conversionService;
202201
}

spring-batch-core/src/main/java/org/springframework/batch/core/repository/explore/support/JobExplorerFactoryBean.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
import org.springframework.batch.core.job.DefaultJobKeyGenerator;
2525

26-
import org.jspecify.annotations.NonNull;
2726
import org.springframework.batch.core.job.JobKeyGenerator;
2827
import org.springframework.batch.core.converter.DateToStringConverter;
2928
import org.springframework.batch.core.converter.LocalDateTimeToStringConverter;
@@ -146,7 +145,7 @@ public void setJobKeyGenerator(JobKeyGenerator jobKeyGenerator) {
146145
* @see JdbcExecutionContextDao#setCharset(Charset)
147146
* @since 5.0
148147
*/
149-
public void setCharset(@NonNull Charset charset) {
148+
public void setCharset(Charset charset) {
150149
Assert.notNull(charset, "Charset must not be null");
151150
this.charset = charset;
152151
}
@@ -157,7 +156,7 @@ public void setCharset(@NonNull Charset charset) {
157156
* @param conversionService the conversion service to use
158157
* @since 5.0
159158
*/
160-
public void setConversionService(@NonNull ConfigurableConversionService conversionService) {
159+
public void setConversionService(ConfigurableConversionService conversionService) {
161160
Assert.notNull(conversionService, "ConversionService must not be null");
162161
this.conversionService = conversionService;
163162
}

spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/JdbcJobRepositoryFactoryBean.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
import javax.sql.DataSource;
3232
import java.nio.charset.Charset;
3333

34-
import org.jspecify.annotations.NonNull;
35-
3634
/**
3735
* A {@link FactoryBean} that automates the creation of a {@link SimpleJobRepository}
3836
* using JDBC DAO implementations which persist batch metadata in a relational database.
@@ -166,7 +164,7 @@ public void setIncrementerFactory(DataFieldMaxValueIncrementerFactory incremente
166164
* @since 5.0
167165
*/
168166
@Override
169-
public void setCharset(@NonNull Charset charset) {
167+
public void setCharset(Charset charset) {
170168
super.setCharset(charset);
171169
}
172170

@@ -177,7 +175,7 @@ public void setCharset(@NonNull Charset charset) {
177175
* @since 5.0
178176
*/
179177
@Override
180-
public void setConversionService(@NonNull ConfigurableConversionService conversionService) {
178+
public void setConversionService(ConfigurableConversionService conversionService) {
181179
super.setConversionService(conversionService);
182180
}
183181

spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBean.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818

1919
import org.apache.commons.logging.Log;
2020
import org.apache.commons.logging.LogFactory;
21-
import org.jspecify.annotations.NonNull;
22-
2321
import org.springframework.batch.core.converter.DateToStringConverter;
2422
import org.springframework.batch.core.converter.LocalDateTimeToStringConverter;
2523
import org.springframework.batch.core.converter.LocalDateToStringConverter;
@@ -29,7 +27,12 @@
2927
import org.springframework.batch.core.converter.StringToLocalDateTimeConverter;
3028
import org.springframework.batch.core.converter.StringToLocalTimeConverter;
3129
import org.springframework.batch.core.repository.ExecutionContextSerializer;
32-
import org.springframework.batch.core.repository.dao.*;
30+
import org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao;
31+
import org.springframework.batch.core.repository.dao.DefaultExecutionContextSerializer;
32+
import org.springframework.batch.core.repository.dao.ExecutionContextDao;
33+
import org.springframework.batch.core.repository.dao.JobExecutionDao;
34+
import org.springframework.batch.core.repository.dao.JobInstanceDao;
35+
import org.springframework.batch.core.repository.dao.StepExecutionDao;
3336
import org.springframework.batch.core.repository.dao.jdbc.JdbcExecutionContextDao;
3437
import org.springframework.batch.core.repository.dao.jdbc.JdbcJobExecutionDao;
3538
import org.springframework.batch.core.repository.dao.jdbc.JdbcJobInstanceDao;
@@ -202,7 +205,7 @@ public void setIncrementerFactory(DataFieldMaxValueIncrementerFactory incremente
202205
* @see JdbcExecutionContextDao#setCharset(Charset)
203206
* @since 5.0
204207
*/
205-
public void setCharset(@NonNull Charset charset) {
208+
public void setCharset(Charset charset) {
206209
Assert.notNull(charset, "Charset must not be null");
207210
this.charset = charset;
208211
}
@@ -213,7 +216,7 @@ public void setCharset(@NonNull Charset charset) {
213216
* @param conversionService the conversion service to use
214217
* @since 5.0
215218
*/
216-
public void setConversionService(@NonNull ConfigurableConversionService conversionService) {
219+
public void setConversionService(ConfigurableConversionService conversionService) {
217220
Assert.notNull(conversionService, "ConversionService must not be null");
218221
this.conversionService = conversionService;
219222
}

spring-batch-core/src/main/java/org/springframework/batch/core/step/job/DefaultJobParametersExtractor.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
import java.util.Set;
2323

2424
import org.springframework.batch.core.job.Job;
25-
26-
import org.jspecify.annotations.NonNull;
2725
import org.springframework.batch.core.job.parameters.JobParameter;
2826
import org.springframework.batch.core.job.parameters.JobParameters;
2927
import org.springframework.batch.core.job.parameters.JobParametersBuilder;
@@ -101,7 +99,7 @@ public void setUseAllParentParameters(boolean useAllParentParameters) {
10199
* Set the {@link JobParametersConverter} to use.
102100
* @param jobParametersConverter the converter to use. Must not be {@code null}.
103101
*/
104-
public void setJobParametersConverter(@NonNull JobParametersConverter jobParametersConverter) {
102+
public void setJobParametersConverter(JobParametersConverter jobParametersConverter) {
105103
Assert.notNull(jobParametersConverter, "jobParametersConverter must not be null");
106104
this.jobParametersConverter = jobParametersConverter;
107105
}

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemProcessor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.batch.item;
1818

19-
import org.jspecify.annotations.NonNull;
2019
import org.jspecify.annotations.Nullable;
2120

2221
/**
@@ -54,6 +53,6 @@ public interface ItemProcessor<I, O> {
5453
* @throws Exception thrown if exception occurs during processing.
5554
*/
5655
@Nullable
57-
O process(@NonNull I item) throws Exception;
56+
O process(I item) throws Exception;
5857

5958
}

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemWriter.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package org.springframework.batch.item;
1818

19-
import org.jspecify.annotations.NonNull;
20-
2119
/**
2220
* <p>
2321
* Basic interface for generic output operations. Class implementing this interface will
@@ -48,6 +46,6 @@ public interface ItemWriter<T> {
4846
* @throws Exception if there are errors. The framework will catch the exception and
4947
* convert or rethrow it as appropriate.
5048
*/
51-
void write(@NonNull Chunk<? extends T> chunk) throws Exception;
49+
void write(Chunk<? extends T> chunk) throws Exception;
5250

5351
}

0 commit comments

Comments
 (0)