In Spring Data Jpa (at least since 2.2.x, still present in 2.3.x) there seem to be some wrong annotations. Unless this is by design, the following @Nullable
-annotated methods should be changed.
org.springframework.data.jpa.domain.SpecificationComposition.composed(Specification, Specification, Combiner)
The method is annotated with @Nullable
even though it always returns a specification. Thus the method should be annotated with @NonNull
instead.
As a consequence of this change the methods org.springframework.data.jpa.domain.Specification.and(Specification)
and org.springframework.data.jpa.domain.Specification.or(Specification)
should also be annotated with @NonNull
since they return the output from composed
org.springframework.data.jpa.domain.Specification.where(Specification)
The method is annotated with @Nullable
even though it's only purpose is converting null
values passed as parameter into a specification that returns null als predicate.
This means the return value actually always is an actual specification. Thus the method should be annotated with @NonNull
instead.
org.springframework.data.jpa.domain.Specification.not(Specification)
The method is not annotated. However it makes sure to always return a specification.
Thus it could be annotated with @NonNull
Comment From: bclozel
Could you create an issue in the Spring Data JPA issue tracker? Thanks!