google / gson

A Java serialization/deserialization library to convert Java Objects into JSON and back
Apache License 2.0
23.13k stars 4.27k forks source link

Document that `JsonReader` methods throw `IllegalStateException` #2670

Closed Marcono1234 closed 2 months ago

Marcono1234 commented 2 months ago

Purpose

Resolves #2663

Description

As mentioned in #2663 and the comments, the JsonReader documentation currently does not mention for all methods that an IllegalStateException is thrown for mismatching JSON tokens.

This pull request adds the missing documentation, adjusts the existing documentation to be consistent, and also mentions for close() that subsequent use will cause an IllegalStateException.

Checklist

eamonnmcmanus commented 2 months ago

Thanks!