Skip to content

Commit f13eaf5

Browse files
committed
Add missing nullability type constraints to findBy methods.
Closes #3986
1 parent 71f15d8 commit f13eaf5

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/QuerydslJpaPredicateExecutor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ public Page<T> findAll(Predicate predicate, Pageable pageable) {
181181

182182
@SuppressWarnings("unchecked")
183183
@Override
184-
public <S extends T, R> R findBy(Predicate predicate, Function<FetchableFluentQuery<S>, R> queryFunction) {
184+
public <S extends T, R extends @Nullable Object> R findBy(Predicate predicate,
185+
Function<FetchableFluentQuery<S>, R> queryFunction) {
185186

186187
Assert.notNull(predicate, PREDICATE_MUST_NOT_BE_NULL);
187188
Assert.notNull(queryFunction, QUERY_FUNCTION_MUST_NOT_BE_NULL);

spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/SimpleJpaRepository.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ public long delete(DeleteSpecification<T> spec) {
518518
}
519519

520520
@Override
521-
public <S extends T, R> R findBy(Specification<T> spec,
521+
public <S extends T, R extends @Nullable Object> R findBy(Specification<T> spec,
522522
Function<? super SpecificationFluentQuery<S>, R> queryFunction) {
523523

524524
Assert.notNull(spec, SPECIFICATION_MUST_NOT_BE_NULL);
@@ -626,7 +626,8 @@ public <S extends T> Page<S> findAll(Example<S> example, Pageable pageable) {
626626

627627
@Override
628628
@SuppressWarnings("unchecked")
629-
public <S extends T, R> R findBy(Example<S> example, Function<FetchableFluentQuery<S>, R> queryFunction) {
629+
public <S extends T, R extends @Nullable Object> R findBy(Example<S> example,
630+
Function<FetchableFluentQuery<S>, R> queryFunction) {
630631

631632
Assert.notNull(example, EXAMPLE_MUST_NOT_BE_NULL);
632633
Assert.notNull(queryFunction, QUERY_FUNCTION_MUST_NOT_BE_NULL);

0 commit comments

Comments
 (0)