Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3be2fa5

Browse files
committed
Fix NullAway findings
Signed-off-by: Stefano Cordio <stefano.cordio@gmail.com>
1 parent 624ab14 commit 3be2fa5

File tree

108 files changed

+720
-609
lines changed

Some content is hidden

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

108 files changed

+720
-609
lines changed

‎pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@
191191
<!-- Check JSpecify annotations -->
192192
-Xep:NullAway:ERROR
193193
-XepOpt:NullAway:OnlyNullMarked
194+
-XepOpt:NullAway:CustomContractAnnotations=org.springframework.lang.Contract
194195
</compilerArg>
195196
</compilerArgs>
196197
<annotationProcessorPaths>

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ private Collection<Job> doLoad(ApplicationContextFactory factory, boolean unregi
222222
* @return all the {@link Step} defined by the given step locator and context
223223
* @see StepLocator
224224
*/
225-
private Collection<Step> getSteps(finalStepLocator stepLocator,final ApplicationContext jobApplicationContext) {
226-
finalCollection<String> stepNames = stepLocator.getStepNames();
227-
finalCollection<Step> result = new ArrayList<>();
225+
private Collection<Step> getSteps(StepLocator stepLocator, ApplicationContext jobApplicationContext) {
226+
Collection<String> stepNames = stepLocator.getStepNames();
227+
Collection<Step> result = new ArrayList<>();
228228
for (String stepName : stepNames) {
229229
result.add(stepLocator.getStep(stepName));
230230
}
@@ -234,7 +234,7 @@ private Collection<Step> getSteps(final StepLocator stepLocator, final Applicati
234234
// are more Step instances defined. Right now they are registered as being
235235
// available in the
236236
// context of the job but we have no idea if they are linked to that Job or not.
237-
finalMap<String, Step> allSteps = jobApplicationContext.getBeansOfType(Step.class);
237+
Map<String, Step> allSteps = jobApplicationContext.getBeansOfType(Step.class);
238238
for (Map.Entry<String, Step> entry : allSteps.entrySet()) {
239239
if (!stepNames.contains(entry.getKey())) {
240240
result.add(entry.getValue());

‎spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowExecutor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ public interface FlowExecutor {
5151
/**
5252
* @return the latest {@link StepExecution} or null if there is none
5353
*/
54-
@Nullable
55-
StepExecution getStepExecution();
54+
@Nullable StepExecution getStepExecution();
5655

5756
/**
5857
* Chance to clean up resources at the end of a flow (whether it completed

‎spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowJob.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public Collection<String> getStepNames() {
127127
* @see AbstractJob#doExecute(JobExecution)
128128
*/
129129
@Override
130-
protected void doExecute(finalJobExecution execution) throws JobExecutionException {
130+
protected void doExecute(JobExecution execution) throws JobExecutionException {
131131
try {
132132
JobFlowExecutor executor = new JobFlowExecutor(getJobRepository(),
133133
new SimpleStepHandler(getJobRepository()), execution);

‎spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/SplitState.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ public Collection<Flow> getFlows() {
9797
* @see State#handle(FlowExecutor)
9898
*/
9999
@Override
100-
public FlowExecutionStatus handle(finalFlowExecutor executor) throws Exception {
100+
public FlowExecutionStatus handle(FlowExecutor executor) throws Exception {
101101

102102
// TODO: collect the last StepExecution from the flows as well, so they
103103
// can be abandoned if necessary
104104
Collection<Future<FlowExecution>> tasks = new ArrayList<>();
105105

106-
for (finalFlow flow : flows) {
106+
for (Flow flow : flows) {
107107

108108
final FutureTask<FlowExecution> task = new FutureTask<>(() -> flow.start(executor));
109109

‎spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/TaskExecutorJobLauncher.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,8 @@ public class TaskExecutorJobLauncher implements JobLauncher, InitializingBean {
9898
* @throws JobParametersInvalidException thrown if jobParameters is invalid.
9999
*/
100100
@Override
101-
public JobExecution run(final Job job, final JobParameters jobParameters)
102-
throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException,
103-
JobParametersInvalidException {
101+
public JobExecution run(Job job, final JobParameters jobParameters) throws JobExecutionAlreadyRunningException,
102+
JobRestartException, JobInstanceAlreadyCompleteException, JobParametersInvalidException {
104103

105104
Assert.notNull(job, "The Job must not be null.");
106105
Assert.notNull(jobParameters, "The JobParameters must not be null.");

‎spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/AbstractPartitionHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected abstract Set<StepExecution> doHandle(StepExecution managerStepExecutio
5252
* @see PartitionHandler#handle(StepExecutionSplitter, StepExecution)
5353
*/
5454
@Override
55-
public Collection<StepExecution> handle(finalStepExecutionSplitter stepSplitter,
55+
public Collection<StepExecution> handle(StepExecutionSplitter stepSplitter,
5656
final StepExecution managerStepExecution) throws Exception {
5757
final Set<StepExecution> stepExecutions = stepSplitter.split(managerStepExecution, gridSize);
5858

‎spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/TaskExecutorPartitionHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ protected Set<StepExecution> doHandle(StepExecution managerStepExecution,
9393
final Set<Future<StepExecution>> tasks = new HashSet<>(getGridSize());
9494
final Set<StepExecution> result = new HashSet<>();
9595

96-
for (finalStepExecution stepExecution : partitionStepExecutions) {
96+
for (StepExecution stepExecution : partitionStepExecutions) {
9797
final FutureTask<StepExecution> task = createTask(step, stepExecution);
9898

9999
try {
@@ -127,7 +127,7 @@ protected Set<StepExecution> doHandle(StepExecution managerStepExecution,
127127
* @param stepExecution the given execution
128128
* @return the task executing the given step
129129
*/
130-
protected FutureTask<StepExecution> createTask(finalStep step, final StepExecution stepExecution) {
130+
protected FutureTask<StepExecution> createTask(Step step, final StepExecution stepExecution) {
131131
return new FutureTask<>(() -> {
132132
step.execute(stepExecution);
133133
return stepExecution;

‎spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/ExecutionContextDao.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,36 +48,36 @@ public interface ExecutionContextDao {
4848
* entry for the context should not exist yet.
4949
* @param jobExecution {@link JobExecution} instance that contains the context.
5050
*/
51-
void saveExecutionContext(finalJobExecution jobExecution);
51+
void saveExecutionContext(JobExecution jobExecution);
5252

5353
/**
5454
* Persist the execution context associated with the given stepExecution, persistent
5555
* entry for the context should not exist yet.
5656
* @param stepExecution {@link StepExecution} instance that contains the context.
5757
*/
58-
void saveExecutionContext(finalStepExecution stepExecution);
58+
void saveExecutionContext(StepExecution stepExecution);
5959

6060
/**
6161
* Persist the execution context associated with each stepExecution in a given
6262
* collection, persistent entry for the context should not exist yet.
6363
* @param stepExecutions a collection of {@link StepExecution}s that contain the
6464
* contexts.
6565
*/
66-
void saveExecutionContexts(finalCollection<StepExecution> stepExecutions);
66+
void saveExecutionContexts(Collection<StepExecution> stepExecutions);
6767

6868
/**
6969
* Persist the updates of execution context associated with the given jobExecution.
7070
* Persistent entry should already exist for this context.
7171
* @param jobExecution {@link JobExecution} instance that contains the context.
7272
*/
73-
void updateExecutionContext(finalJobExecution jobExecution);
73+
void updateExecutionContext(JobExecution jobExecution);
7474

7575
/**
7676
* Persist the updates of execution context associated with the given stepExecution.
7777
* Persistent entry should already exist for this context.
7878
* @param stepExecution {@link StepExecution} instance that contains the context.
7979
*/
80-
void updateExecutionContext(finalStepExecution stepExecution);
80+
void updateExecutionContext(StepExecution stepExecution);
8181

8282
/**
8383
* Delete the execution context of the given {@link JobExecution}.

‎spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JobExecutionDao.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,9 @@
1919
import java.util.List;
2020
import java.util.Set;
2121

22+
import org.jspecify.annotations.Nullable;
2223
import org.springframework.batch.core.job.JobExecution;
2324
import org.springframework.batch.core.job.JobInstance;
24-
import org.springframework.lang.Nullable;
25-
import org.springframework.batch.core.JobExecution;
26-
27-
import org.jspecify.annotations.Nullable;
28-
import org.springframework.batch.core.JobInstance;
2925

3026
/**
3127
* Data Access Object for job executions.
@@ -68,8 +64,7 @@ public interface JobExecutionDao {
6864
* @return the last {@link JobExecution} to execute for this instance or {@code null}
6965
* if no job execution is found for the given job instance.
7066
*/
71-
@Nullable
72-
JobExecution getLastJobExecution(JobInstance jobInstance);
67+
@Nullable JobExecution getLastJobExecution(JobInstance jobInstance);
7368

7469
/**
7570
* @param jobName {@link String} containing the name of the job.
@@ -82,8 +77,7 @@ public interface JobExecutionDao {
8277
* @param executionId {@link Long} containing the id of the execution.
8378
* @return the {@link JobExecution} for given identifier.
8479
*/
85-
@Nullable
86-
JobExecution getJobExecution(Long executionId);
80+
@Nullable JobExecution getJobExecution(Long executionId);
8781

8882
/**
8983
* Because it may be possible that the status of a JobExecution is updated while

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /