Let Kotlin repository generics extend Any.

The move to Kotlin 2.x introduces warnings in the Kotlin extensions for type arguments tha are not within their bounds (i.e. `Thing<T>` should be `Thing<T : Any>`). This commit fixes these cases and removes the warnings.

Signed-off-by: Chris Bono <chris.bono@broadcom.com>
Closes #3309
This commit is contained in:
Chris Bono
2025-06-10 14:53:55 -05:00
committed by Mark Paluch
parent f28a2c2052
commit 06a98db984
3 changed files with 3 additions and 3 deletions

View File

@@ -24,4 +24,4 @@ package org.springframework.data.repository
* @author Oscar Hernandez
* @since 2.1.4
*/
fun <T, ID: Any> CrudRepository<T, ID>.findByIdOrNull(id: ID): T? = findById(id).orElse(null)
fun <T: Any, ID: Any> CrudRepository<T, ID>.findByIdOrNull(id: ID): T? = findById(id).orElse(null)

View File

@@ -37,7 +37,7 @@ import reactor.core.publisher.Mono
* @see Flow
*/
@NoRepositoryBean
interface CoroutineCrudRepository<T, ID> : Repository<T, ID> {
interface CoroutineCrudRepository<T: Any, ID: Any> : Repository<T, ID> {
/**
* Saves a given entity. Use the returned instance for further operations as the save operation might have changed the

View File

@@ -34,7 +34,7 @@ import org.springframework.data.repository.Repository
* @see CoroutineCrudRepository
*/
@NoRepositoryBean
interface CoroutineSortingRepository<T, ID> : Repository<T, ID> {
interface CoroutineSortingRepository<T: Any, ID: Any> : Repository<T, ID> {
/**
* Returns all entities sorted by the given options.