Browse Source

Document some non-nullable Kotlin extensions can throw NoSuchElementException

Closes gh-31189
pull/31496/head
Sébastien Deleuze 1 year ago
parent
commit
12a01a680b
  1. 3
      spring-messaging/src/main/kotlin/org/springframework/messaging/rsocket/RSocketRequesterExtensions.kt
  2. 5
      spring-r2dbc/src/main/kotlin/org/springframework/r2dbc/core/RowsFetchSpecExtensions.kt
  3. 3
      spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/client/ClientResponseExtensions.kt
  4. 3
      spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/client/WebClientExtensions.kt
  5. 4
      spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/ServerRequestExtensions.kt

3
spring-messaging/src/main/kotlin/org/springframework/messaging/rsocket/RSocketRequesterExtensions.kt

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -110,6 +110,7 @@ suspend fun RSocketRequester.RetrieveSpec.sendAndAwait() { @@ -110,6 +110,7 @@ suspend fun RSocketRequester.RetrieveSpec.sendAndAwait() {
/**
* Coroutines variant of [RSocketRequester.RetrieveSpec.retrieveMono].
*
* @throws NoSuchElementException if the underlying [Mono] does not emit any value
* @author Sebastien Deleuze
* @since 5.2
*/

5
spring-r2dbc/src/main/kotlin/org/springframework/r2dbc/core/RowsFetchSpecExtensions.kt

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,10 +19,12 @@ import kotlinx.coroutines.flow.Flow @@ -19,10 +19,12 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.asFlow
import kotlinx.coroutines.reactor.awaitSingleOrNull
import org.springframework.dao.EmptyResultDataAccessException
import reactor.core.publisher.Mono
/**
* Non-nullable Coroutines variant of [RowsFetchSpec.one].
*
* @throws EmptyResultDataAccessException if the underlying [Mono] does not emit any value
* @author Sebastien Deleuze
*/
@Suppress("DEPRECATION")
@ -42,6 +44,7 @@ suspend fun <T> RowsFetchSpec<T>.awaitOneOrNull(): T? = @@ -42,6 +44,7 @@ suspend fun <T> RowsFetchSpec<T>.awaitOneOrNull(): T? =
/**
* Non-nullable Coroutines variant of [RowsFetchSpec.first].
*
* @throws EmptyResultDataAccessException if the underlying [Mono] does not emit any value
* @author Sebastien Deleuze
*/
@Suppress("DEPRECATION")

3
spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/client/ClientResponseExtensions.kt

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -102,6 +102,7 @@ suspend inline fun <reified T : Any> ClientResponse.awaitBody(): T = @@ -102,6 +102,7 @@ suspend inline fun <reified T : Any> ClientResponse.awaitBody(): T =
* `KClass` non-nullable coroutines variant of [ClientResponse.bodyToMono].
* Please consider `awaitBody<Foo>` variant if possible.
*
* @throws NoSuchElementException if the underlying [Mono] does not emit any value
* @author Igor Manushin
* @since 5.3
*/

3
spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/client/WebClientExtensions.kt

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -143,6 +143,7 @@ inline fun <reified T : Any> WebClient.ResponseSpec.bodyToFlow(): Flow<T> = @@ -143,6 +143,7 @@ inline fun <reified T : Any> WebClient.ResponseSpec.bodyToFlow(): Flow<T> =
/**
* Coroutines variant of [WebClient.ResponseSpec.bodyToMono].
*
* @throws NoSuchElementException if the underlying [Mono] does not emit any value
* @author Sebastien Deleuze
* @since 5.2
*/

4
spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/ServerRequestExtensions.kt

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -76,6 +76,7 @@ fun <T : Any> ServerRequest.bodyToFlow(clazz: KClass<T>): Flow<T> = @@ -76,6 +76,7 @@ fun <T : Any> ServerRequest.bodyToFlow(clazz: KClass<T>): Flow<T> =
/**
* Non-nullable Coroutines variant of [ServerRequest.bodyToMono].
*
* @throws NoSuchElementException if the underlying [Mono] does not emit any value
* @author Sebastien Deleuze
* @since 5.2
*/
@ -86,6 +87,7 @@ suspend inline fun <reified T : Any> ServerRequest.awaitBody(): T = @@ -86,6 +87,7 @@ suspend inline fun <reified T : Any> ServerRequest.awaitBody(): T =
* `KClass` non-nullable Coroutines variant of [ServerRequest.bodyToMono].
* Please consider `awaitBody<Foo>` variant if possible.
*
* @throws NoSuchElementException if the underlying [Mono] does not emit any value
* @author Igor Manushin
* @since 5.3
*/

Loading…
Cancel
Save