Skip to content

Commit b875b5d

Browse files
committed
Remove unnecessary @NonNull
Signed-off-by: Stefano Cordio <[email protected]>
1 parent 320e25d commit b875b5d

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/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/JobParametersBuilder.java

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
import org.springframework.batch.core.repository.explore.JobExplorer;
2727

28-
import org.jspecify.annotations.NonNull;
2928
import org.springframework.util.Assert;
3029

3130
/**
@@ -93,7 +92,7 @@ public JobParametersBuilder(JobParameters jobParameters, JobExplorer jobExplorer
9392
* @param parameter The runtime parameter. Must not be {@code null}.
9493
* @return a reference to this object.
9594
*/
96-
public JobParametersBuilder addString(String key, @NonNull String parameter) {
95+
public JobParametersBuilder addString(String key, String parameter) {
9796
return addString(key, parameter, true);
9897
}
9998

@@ -105,7 +104,7 @@ public JobParametersBuilder addString(String key, @NonNull String parameter) {
105104
* job instance.
106105
* @return a reference to this object.
107106
*/
108-
public JobParametersBuilder addString(String key, @NonNull String parameter, boolean identifying) {
107+
public JobParametersBuilder addString(String key, String parameter, boolean identifying) {
109108
Assert.notNull(parameter, "Value for parameter '" + key + "' must not be null");
110109
this.parameterMap.put(key, new JobParameter<>(parameter, String.class, identifying));
111110
return this;
@@ -117,7 +116,7 @@ public JobParametersBuilder addString(String key, @NonNull String parameter, boo
117116
* @param parameter The runtime parameter. Must not be {@code null}.
118117
* @return a reference to this object.
119118
*/
120-
public JobParametersBuilder addDate(String key, @NonNull Date parameter) {
119+
public JobParametersBuilder addDate(String key, Date parameter) {
121120
return addDate(key, parameter, true);
122121
}
123122

@@ -129,7 +128,7 @@ public JobParametersBuilder addDate(String key, @NonNull Date parameter) {
129128
* instance
130129
* @return a reference to this object.
131130
*/
132-
public JobParametersBuilder addDate(String key, @NonNull Date parameter, boolean identifying) {
131+
public JobParametersBuilder addDate(String key, Date parameter, boolean identifying) {
133132
Assert.notNull(parameter, "Value for parameter '" + key + "' must not be null");
134133
this.parameterMap.put(key, new JobParameter<>(parameter, Date.class, identifying));
135134
return this;
@@ -141,7 +140,7 @@ public JobParametersBuilder addDate(String key, @NonNull Date parameter, boolean
141140
* @param parameter The runtime parameter. Must not be {@code null}.
142141
* @return a reference to this object.
143142
*/
144-
public JobParametersBuilder addLocalDate(String key, @NonNull LocalDate parameter) {
143+
public JobParametersBuilder addLocalDate(String key, LocalDate parameter) {
145144
return addLocalDate(key, parameter, true);
146145
}
147146

@@ -153,7 +152,7 @@ public JobParametersBuilder addLocalDate(String key, @NonNull LocalDate paramete
153152
* instance
154153
* @return a reference to this object.
155154
*/
156-
public JobParametersBuilder addLocalDate(String key, @NonNull LocalDate parameter, boolean identifying) {
155+
public JobParametersBuilder addLocalDate(String key, LocalDate parameter, boolean identifying) {
157156
Assert.notNull(parameter, "Value for parameter '" + key + "' must not be null");
158157
this.parameterMap.put(key, new JobParameter<>(parameter, LocalDate.class, identifying));
159158
return this;
@@ -165,7 +164,7 @@ public JobParametersBuilder addLocalDate(String key, @NonNull LocalDate paramete
165164
* @param parameter The runtime parameter. Must not be {@code null}.
166165
* @return a reference to this object.
167166
*/
168-
public JobParametersBuilder addLocalTime(String key, @NonNull LocalTime parameter) {
167+
public JobParametersBuilder addLocalTime(String key, LocalTime parameter) {
169168
return addLocalTime(key, parameter, true);
170169
}
171170

@@ -177,7 +176,7 @@ public JobParametersBuilder addLocalTime(String key, @NonNull LocalTime paramete
177176
* instance
178177
* @return a reference to this object.
179178
*/
180-
public JobParametersBuilder addLocalTime(String key, @NonNull LocalTime parameter, boolean identifying) {
179+
public JobParametersBuilder addLocalTime(String key, LocalTime parameter, boolean identifying) {
181180
Assert.notNull(parameter, "Value for parameter '" + key + "' must not be null");
182181
this.parameterMap.put(key, new JobParameter<>(parameter, LocalTime.class, identifying));
183182
return this;
@@ -189,7 +188,7 @@ public JobParametersBuilder addLocalTime(String key, @NonNull LocalTime paramete
189188
* @param parameter The runtime parameter. Must not be {@code null}.
190189
* @return a reference to this object.
191190
*/
192-
public JobParametersBuilder addLocalDateTime(String key, @NonNull LocalDateTime parameter) {
191+
public JobParametersBuilder addLocalDateTime(String key, LocalDateTime parameter) {
193192
return addLocalDateTime(key, parameter, true);
194193
}
195194

@@ -201,7 +200,7 @@ public JobParametersBuilder addLocalDateTime(String key, @NonNull LocalDateTime
201200
* instance
202201
* @return a reference to this object.
203202
*/
204-
public JobParametersBuilder addLocalDateTime(String key, @NonNull LocalDateTime parameter, boolean identifying) {
203+
public JobParametersBuilder addLocalDateTime(String key, LocalDateTime parameter, boolean identifying) {
205204
Assert.notNull(parameter, "Value for parameter '" + key + "' must not be null");
206205
this.parameterMap.put(key, new JobParameter<>(parameter, LocalDateTime.class, identifying));
207206
return this;
@@ -213,7 +212,7 @@ public JobParametersBuilder addLocalDateTime(String key, @NonNull LocalDateTime
213212
* @param parameter The runtime parameter. Must not be {@code null}.
214213
* @return a reference to this object.
215214
*/
216-
public JobParametersBuilder addLong(String key, @NonNull Long parameter) {
215+
public JobParametersBuilder addLong(String key, Long parameter) {
217216
return addLong(key, parameter, true);
218217
}
219218

@@ -225,7 +224,7 @@ public JobParametersBuilder addLong(String key, @NonNull Long parameter) {
225224
* instance.
226225
* @return a reference to this object.
227226
*/
228-
public JobParametersBuilder addLong(String key, @NonNull Long parameter, boolean identifying) {
227+
public JobParametersBuilder addLong(String key, Long parameter, boolean identifying) {
229228
Assert.notNull(parameter, "Value for parameter '" + key + "' must not be null");
230229
this.parameterMap.put(key, new JobParameter<>(parameter, Long.class, identifying));
231230
return this;
@@ -237,7 +236,7 @@ public JobParametersBuilder addLong(String key, @NonNull Long parameter, boolean
237236
* @param parameter The runtime parameter. Must not be {@code null}.
238237
* @return a reference to this object.
239238
*/
240-
public JobParametersBuilder addDouble(String key, @NonNull Double parameter) {
239+
public JobParametersBuilder addDouble(String key, Double parameter) {
241240
return addDouble(key, parameter, true);
242241
}
243242

@@ -249,7 +248,7 @@ public JobParametersBuilder addDouble(String key, @NonNull Double parameter) {
249248
* instance.
250249
* @return a reference to this object.
251250
*/
252-
public JobParametersBuilder addDouble(String key, @NonNull Double parameter, boolean identifying) {
251+
public JobParametersBuilder addDouble(String key, Double parameter, boolean identifying) {
253252
Assert.notNull(parameter, "Value for parameter '" + key + "' must not be null");
254253
this.parameterMap.put(key, new JobParameter<>(parameter, Double.class, identifying));
255254
return this;
@@ -286,7 +285,7 @@ public JobParametersBuilder addJobParameter(String key, JobParameter<?> jobParam
286285
* @param <T> the type of the parameter
287286
* @since 5.0
288287
*/
289-
public <T> JobParametersBuilder addJobParameter(String name, @NonNull T value, Class<T> type, boolean identifying) {
288+
public <T> JobParametersBuilder addJobParameter(String name, T value, Class<T> type, boolean identifying) {
290289
Assert.notNull(value, "Value for parameter '" + name + "' must not be null");
291290
return addJobParameter(name, new JobParameter<>(value, type, identifying));
292291
}
@@ -300,7 +299,7 @@ public <T> JobParametersBuilder addJobParameter(String name, @NonNull T value, C
300299
* @param <T> the type of the parameter
301300
* @since 5.0
302301
*/
303-
public <T> JobParametersBuilder addJobParameter(String name, @NonNull T value, Class<T> type) {
302+
public <T> JobParametersBuilder addJobParameter(String name, T value, Class<T> type) {
304303
return addJobParameter(name, value, type, true);
305304
}
306305

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.JobParameter;
2323

24-
import org.jspecify.annotations.NonNull;
2524
import org.jspecify.annotations.Nullable;
2625
import org.springframework.batch.core.JobParameters;
2726
import org.springframework.batch.core.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/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.JobExecution;
3737

38-
import org.jspecify.annotations.NonNull;
3938
import org.springframework.batch.core.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.DefaultJobKeyGenerator;
2525

26-
import org.jspecify.annotations.NonNull;
2726
import org.springframework.batch.core.JobKeyGenerator;
2827
import org.springframework.batch.core.converter.DateToStringConverter;
2928
import org.springframework.batch.core.converter.LocalDateTimeToStringConverter;
@@ -145,7 +144,7 @@ public void setJobKeyGenerator(JobKeyGenerator jobKeyGenerator) {
145144
* @see JdbcExecutionContextDao#setCharset(Charset)
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
}
@@ -156,7 +155,7 @@ public void setCharset(@NonNull Charset charset) {
156155
* @param conversionService the conversion service to use
157156
* @since 5.0
158157
*/
159-
public void setConversionService(@NonNull ConfigurableConversionService conversionService) {
158+
public void setConversionService(ConfigurableConversionService conversionService) {
160159
Assert.notNull(conversionService, "ConversionService must not be null");
161160
this.conversionService = conversionService;
162161
}

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;
25-
26-
import org.jspecify.annotations.NonNull;
2725
import org.springframework.batch.core.JobParameter;
2826
import org.springframework.batch.core.JobParameters;
2927
import org.springframework.batch.core.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)