Skip to content

Update retrieval methods with clear nullability semantics #4988

@fmbenhassine

Description

@fmbenhassine

Several retrieval APIs are inconsistent with regard to the nullability semantics of return values. Some of them use exceptions to signal the absence of an element (such as JobRegistry#getJob(String name) throws NoSuchJobException, while other return null (like JobRepository#getJobInstance(Long instanceId)).

Moreover, there are several implementations that do no adhere to the contract they implement. For example, org.springframework.batch.core.step.StepLocator#getStep(String stepName) throws NoSuchStepException clearly states that implementations must throw a NoSuchStepException when a step is not found, yet SimpleJob might return null.

With the introduction of jSpecify, we need to review all public APIs and revisit their implementations towards a consistent approach of handling return values.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions