Skip to content

Commit 74144b5

Browse files
committed
Add missing type constraints to findBy repository methods.
Closes #5050
1 parent 3b6798f commit 74144b5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/QuerydslMongoPredicateExecutor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
import java.util.stream.Stream;
2323

2424
import org.bson.Document;
25-
2625
import org.jspecify.annotations.Nullable;
26+
2727
import org.springframework.dao.IncorrectResultSizeDataAccessException;
2828
import org.springframework.data.domain.Page;
2929
import org.springframework.data.domain.Pageable;
@@ -165,7 +165,7 @@ public boolean exists(Predicate predicate) {
165165

166166
@Override
167167
@SuppressWarnings("unchecked")
168-
public <S extends T, R> R findBy(Predicate predicate,
168+
public <S extends T, R extends @Nullable Object> R findBy(Predicate predicate,
169169
Function<FluentQuery.FetchableFluentQuery<S>, R> queryFunction) {
170170

171171
Assert.notNull(predicate, "Predicate must not be null");

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/SimpleMongoRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ public <S extends T> boolean exists(Example<S> example) {
341341
}
342342

343343
@Override
344-
public <S extends T, R> R findBy(Example<S> example,
344+
public <S extends T, R extends @Nullable Object> R findBy(Example<S> example,
345345
Function<org.springframework.data.repository.query.FluentQuery.FetchableFluentQuery<S>, R> queryFunction) {
346346

347347
Assert.notNull(example, "Sample must not be null");

0 commit comments

Comments
 (0)