docs(serialize): add note on unchecked exceptions in SerializeReader.iterator and .stream
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Johannes Frohnmeyer 2024-05-04 20:33:29 +02:00
parent 133e1d75f9
commit 21beed944d
Signed by: Johannes
GPG Key ID: E76429612C2929F4
1 changed files with 4 additions and 0 deletions

View File

@ -110,6 +110,8 @@ public abstract class SerializeReader<TEx extends Exception, T extends Serialize
* Returns a {@link Stream} of the tokens within the current object or array.
* The stream consumes tokens and advances the reader, so it is not possible to iterate over the tokens more than once.
* Additionally, iteration may throw {@link RuntimeException}s created with {@link ExceptionWrapper#wrap(Throwable)} around {@link TEx}.
* That exception MUST be caught and handled by the caller immediately. Throwing it in a TypeAdapter is NOT allowed.
*
* @return a stream of the tokens
*/
public @NotNull Stream<RToken> stream() {
@ -120,6 +122,8 @@ public abstract class SerializeReader<TEx extends Exception, T extends Serialize
* Returns an {@link Iterator} over the tokens within the current object or array.
* The iterator consumes tokens and advances the reader, so it is not possible to iterate over the tokens more than once.
* Additionally, iteration may throw {@link RuntimeException}s created with {@link ExceptionWrapper#wrap(Throwable)} around {@link TEx}.
* That exception MUST be caught and handled by the caller immediately. Throwing it in a TypeAdapter is NOT allowed.
*
* @return an iterator over the tokens
*/
@Override