Document some non-nullable Kotlin extensions can throw NoSuchElementException

Closes gh-31189
This commit is contained in:
Sébastien Deleuze 2023-09-08 13:03:25 +02:00
parent 740f3b797f
commit 12a01a680b
5 changed files with 13 additions and 5 deletions

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -110,6 +110,7 @@ suspend fun RSocketRequester.RetrieveSpec.sendAndAwait() {
/** /**
* Coroutines variant of [RSocketRequester.RetrieveSpec.retrieveMono]. * Coroutines variant of [RSocketRequester.RetrieveSpec.retrieveMono].
* *
* @throws NoSuchElementException if the underlying [Mono] does not emit any value
* @author Sebastien Deleuze * @author Sebastien Deleuze
* @since 5.2 * @since 5.2
*/ */

View File

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

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 =
* `KClass` non-nullable coroutines variant of [ClientResponse.bodyToMono]. * `KClass` non-nullable coroutines variant of [ClientResponse.bodyToMono].
* Please consider `awaitBody<Foo>` variant if possible. * Please consider `awaitBody<Foo>` variant if possible.
* *
* @throws NoSuchElementException if the underlying [Mono] does not emit any value
* @author Igor Manushin * @author Igor Manushin
* @since 5.3 * @since 5.3
*/ */

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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> =
/** /**
* Coroutines variant of [WebClient.ResponseSpec.bodyToMono]. * Coroutines variant of [WebClient.ResponseSpec.bodyToMono].
* *
* @throws NoSuchElementException if the underlying [Mono] does not emit any value
* @author Sebastien Deleuze * @author Sebastien Deleuze
* @since 5.2 * @since 5.2
*/ */

View File

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