Skip to content

Commit 12a01a6

Browse files
committed
Document some non-nullable Kotlin extensions can throw NoSuchElementException
Closes gh-31189
1 parent 740f3b7 commit 12a01a6

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -110,6 +110,7 @@ suspend fun RSocketRequester.RetrieveSpec.sendAndAwait() {
110110
/**
111111
* Coroutines variant of [RSocketRequester.RetrieveSpec.retrieveMono].
112112
*
113+
* @throws NoSuchElementException if the underlying [Mono] does not emit any value
113114
* @author Sebastien Deleuze
114115
* @since 5.2
115116
*/

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,10 +19,12 @@ import kotlinx.coroutines.flow.Flow
1919
import kotlinx.coroutines.reactive.asFlow
2020
import kotlinx.coroutines.reactor.awaitSingleOrNull
2121
import org.springframework.dao.EmptyResultDataAccessException
22+
import reactor.core.publisher.Mono
2223

2324
/**
2425
* Non-nullable Coroutines variant of [RowsFetchSpec.one].
2526
*
27+
* @throws EmptyResultDataAccessException if the underlying [Mono] does not emit any value
2628
* @author Sebastien Deleuze
2729
*/
2830
@Suppress("DEPRECATION")
@@ -42,6 +44,7 @@ suspend fun <T> RowsFetchSpec<T>.awaitOneOrNull(): T? =
4244
/**
4345
* Non-nullable Coroutines variant of [RowsFetchSpec.first].
4446
*
47+
* @throws EmptyResultDataAccessException if the underlying [Mono] does not emit any value
4548
* @author Sebastien Deleuze
4649
*/
4750
@Suppress("DEPRECATION")

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* 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 =
102102
* `KClass` non-nullable coroutines variant of [ClientResponse.bodyToMono].
103103
* Please consider `awaitBody<Foo>` variant if possible.
104104
*
105+
* @throws NoSuchElementException if the underlying [Mono] does not emit any value
105106
* @author Igor Manushin
106107
* @since 5.3
107108
*/

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* 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> =
143143
/**
144144
* Coroutines variant of [WebClient.ResponseSpec.bodyToMono].
145145
*
146+
* @throws NoSuchElementException if the underlying [Mono] does not emit any value
146147
* @author Sebastien Deleuze
147148
* @since 5.2
148149
*/

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* 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> =
7676
/**
7777
* Non-nullable Coroutines variant of [ServerRequest.bodyToMono].
7878
*
79+
* @throws NoSuchElementException if the underlying [Mono] does not emit any value
7980
* @author Sebastien Deleuze
8081
* @since 5.2
8182
*/
@@ -86,6 +87,7 @@ suspend inline fun <reified T : Any> ServerRequest.awaitBody(): T =
8687
* `KClass` non-nullable Coroutines variant of [ServerRequest.bodyToMono].
8788
* Please consider `awaitBody<Foo>` variant if possible.
8889
*
90+
* @throws NoSuchElementException if the underlying [Mono] does not emit any value
8991
* @author Igor Manushin
9092
* @since 5.3
9193
*/

0 commit comments

Comments
 (0)