From 0510cfa6846deff14340e4f184f65ef01c9bbf9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Thu, 8 May 2025 22:54:30 -0700 Subject: [PATCH] Refine '?' use in Kotlin code --- .../docs/data/nosql/mongodb/repositories/CityRepository.kt | 6 +++--- .../enversrepositories/CountryRepository.kt | 6 +++--- .../sql/jpaandspringdata/repositories/CityRepository.kt | 4 ++-- .../boot/docs/data/sql/r2dbc/repositories/CityRepository.kt | 4 ++-- .../boot/docs/io/restclient/restclient/MyService.kt | 2 +- .../boot/docs/io/restclient/restclient/ssl/MyService.kt | 2 +- .../docs/io/restclient/restclient/ssl/settings/MyService.kt | 2 +- .../boot/docs/io/restclient/webclient/MyService.kt | 2 +- .../boot/docs/io/restclient/webclient/ssl/MyService.kt | 2 +- .../messaging/kafka/streams/MyKafkaStreamsConfiguration.kt | 2 +- .../boot/docs/web/reactive/webflux/CustomerRepository.kt | 2 +- .../boot/docs/web/reactive/webflux/MyRestController.kt | 2 +- .../boot/docs/web/reactive/webflux/UserRepository.kt | 2 +- .../boot/docs/web/servlet/springmvc/CustomerRepository.kt | 2 +- .../boot/docs/web/servlet/springmvc/UserRepository.kt | 2 +- 15 files changed, 21 insertions(+), 21 deletions(-) diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/nosql/mongodb/repositories/CityRepository.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/nosql/mongodb/repositories/CityRepository.kt index 537b733999..db68cd741f 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/nosql/mongodb/repositories/CityRepository.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/nosql/mongodb/repositories/CityRepository.kt @@ -21,7 +21,7 @@ import org.springframework.data.domain.Pageable import org.springframework.data.repository.Repository interface CityRepository : - Repository { - fun findAll(pageable: Pageable?): Page? - fun findByNameAndStateAllIgnoringCase(name: String?, state: String?): City? + Repository { + fun findAll(pageable: Pageable?): Page + fun findByNameAndStateAllIgnoringCase(name: String, state: String): City? } \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/sql/jpaandspringdata/enversrepositories/CountryRepository.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/sql/jpaandspringdata/enversrepositories/CountryRepository.kt index 3a3e69a856..a25a82655e 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/sql/jpaandspringdata/enversrepositories/CountryRepository.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/sql/jpaandspringdata/enversrepositories/CountryRepository.kt @@ -23,9 +23,9 @@ import org.springframework.data.repository.Repository import org.springframework.data.repository.history.RevisionRepository interface CountryRepository : - RevisionRepository, - Repository { + RevisionRepository, + Repository { - fun findAll(pageable: Pageable?): Page? + fun findAll(pageable: Pageable?): Page? } \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/sql/jpaandspringdata/repositories/CityRepository.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/sql/jpaandspringdata/repositories/CityRepository.kt index a247e5f000..5720282c3e 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/sql/jpaandspringdata/repositories/CityRepository.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/sql/jpaandspringdata/repositories/CityRepository.kt @@ -21,9 +21,9 @@ import org.springframework.data.domain.Page import org.springframework.data.domain.Pageable import org.springframework.data.repository.Repository -interface CityRepository : Repository { +interface CityRepository : Repository { - fun findAll(pageable: Pageable?): Page? + fun findAll(pageable: Pageable?): Page? fun findByNameAndStateAllIgnoringCase(name: String?, state: String?): City? diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/sql/r2dbc/repositories/CityRepository.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/sql/r2dbc/repositories/CityRepository.kt index 2454ae7c2d..e5e72e5f12 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/sql/r2dbc/repositories/CityRepository.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/sql/r2dbc/repositories/CityRepository.kt @@ -19,8 +19,8 @@ package org.springframework.boot.docs.data.sql.r2dbc.repositories import org.springframework.data.repository.Repository import reactor.core.publisher.Mono -interface CityRepository : Repository { +interface CityRepository : Repository { - fun findByNameAndStateAllIgnoringCase(name: String?, state: String?): Mono? + fun findByNameAndStateAllIgnoringCase(name: String, state: String): Mono } \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/restclient/MyService.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/restclient/MyService.kt index cb1854c03c..b4b1d40067 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/restclient/MyService.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/restclient/MyService.kt @@ -29,7 +29,7 @@ class MyService(restClientBuilder: RestClient.Builder) { restClient = restClientBuilder.baseUrl("https://example.org").build() } - fun someRestCall(name: String?): Details { + fun someRestCall(name: String): Details { return restClient.get().uri("/{name}/details", name) .retrieve().body(Details::class.java)!! } diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/restclient/ssl/MyService.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/restclient/ssl/MyService.kt index 220a44252e..7612b9d975 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/restclient/ssl/MyService.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/restclient/ssl/MyService.kt @@ -31,7 +31,7 @@ class MyService(restClientBuilder: RestClient.Builder, ssl: RestClientSsl) { .apply(ssl.fromBundle("mybundle")).build() } - fun someRestCall(name: String?): Details { + fun someRestCall(name: String): Details { return restClient.get().uri("/{name}/details", name) .retrieve().body(Details::class.java)!! } diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/restclient/ssl/settings/MyService.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/restclient/ssl/settings/MyService.kt index c4133fa8fb..ec4d29824f 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/restclient/ssl/settings/MyService.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/restclient/ssl/settings/MyService.kt @@ -38,7 +38,7 @@ class MyService(restClientBuilder: RestClient.Builder, sslBundles: SslBundles) { .requestFactory(requestFactory).build() } - fun someRestCall(name: String?): Details { + fun someRestCall(name: String): Details { return restClient.get().uri("/{name}/details", name).retrieve().body(Details::class.java)!! } diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/webclient/MyService.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/webclient/MyService.kt index dc9848d6f2..1d9f063ce1 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/webclient/MyService.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/webclient/MyService.kt @@ -29,7 +29,7 @@ class MyService(webClientBuilder: WebClient.Builder) { webClient = webClientBuilder.baseUrl("https://example.org").build() } - fun someRestCall(name: String?): Mono
{ + fun someRestCall(name: String): Mono
{ return webClient.get().uri("/{name}/details", name) .retrieve().bodyToMono(Details::class.java) } diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/webclient/ssl/MyService.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/webclient/ssl/MyService.kt index 011d84f73f..068de18abb 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/webclient/ssl/MyService.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/webclient/ssl/MyService.kt @@ -31,7 +31,7 @@ class MyService(webClientBuilder: WebClient.Builder, ssl: WebClientSsl) { .apply(ssl.fromBundle("mybundle")).build() } - fun someRestCall(name: String?): Mono
{ + fun someRestCall(name: String): Mono
{ return webClient.get().uri("/{name}/details", name) .retrieve().bodyToMono(Details::class.java) } diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/messaging/kafka/streams/MyKafkaStreamsConfiguration.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/messaging/kafka/streams/MyKafkaStreamsConfiguration.kt index 50fa556566..63b29c1574 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/messaging/kafka/streams/MyKafkaStreamsConfiguration.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/messaging/kafka/streams/MyKafkaStreamsConfiguration.kt @@ -38,7 +38,7 @@ class MyKafkaStreamsConfiguration { return stream } - private fun uppercaseValue(key: Int, value: String): KeyValue { + private fun uppercaseValue(key: Int, value: String): KeyValue { return KeyValue(key, value.uppercase()) } diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/reactive/webflux/CustomerRepository.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/reactive/webflux/CustomerRepository.kt index 9a31322702..12dcb4fd6b 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/reactive/webflux/CustomerRepository.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/reactive/webflux/CustomerRepository.kt @@ -19,7 +19,7 @@ package org.springframework.boot.docs.web.reactive.webflux import org.springframework.data.repository.reactive.ReactiveCrudRepository import reactor.core.publisher.Flux -interface CustomerRepository : ReactiveCrudRepository { +interface CustomerRepository : ReactiveCrudRepository { fun findByUser(user: User?): Flux? diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/reactive/webflux/MyRestController.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/reactive/webflux/MyRestController.kt index 0daffce4af..e122393b92 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/reactive/webflux/MyRestController.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/reactive/webflux/MyRestController.kt @@ -29,7 +29,7 @@ import reactor.core.publisher.Mono class MyRestController(private val userRepository: UserRepository, private val customerRepository: CustomerRepository) { @GetMapping("/{userId}") - fun getUser(@PathVariable userId: Long): Mono { + fun getUser(@PathVariable userId: Long): Mono { return userRepository.findById(userId) } diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/reactive/webflux/UserRepository.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/reactive/webflux/UserRepository.kt index f8340c04da..6340f95d63 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/reactive/webflux/UserRepository.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/reactive/webflux/UserRepository.kt @@ -18,4 +18,4 @@ package org.springframework.boot.docs.web.reactive.webflux import org.springframework.data.repository.reactive.ReactiveCrudRepository -interface UserRepository : ReactiveCrudRepository +interface UserRepository : ReactiveCrudRepository diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/CustomerRepository.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/CustomerRepository.kt index 5dbdc55cfa..2eda1d2a3f 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/CustomerRepository.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/CustomerRepository.kt @@ -18,7 +18,7 @@ package org.springframework.boot.docs.web.servlet.springmvc import org.springframework.data.repository.CrudRepository -interface CustomerRepository : CrudRepository { +interface CustomerRepository : CrudRepository { fun findByUser(user: User?): List? diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/UserRepository.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/UserRepository.kt index b2eb0c7afb..2cff9faf35 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/UserRepository.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/UserRepository.kt @@ -18,4 +18,4 @@ package org.springframework.boot.docs.web.servlet.springmvc import org.springframework.data.repository.CrudRepository -interface UserRepository : CrudRepository +interface UserRepository : CrudRepository