JSON-java
JSON-java copied to clipboard
JSONTokener should implement java.io.Closeable
While JSONTokener(java.io.Reader)
and JSONTokener(java.io.InputStream)
constructors have explicit notes about JSONTokener not closing the reader/stream, I’d like to have it close the reader/stream. Implementing java.io.Closeable
isn’t backward-incompatible (if the library user doesn’t explicitly close it, nothing happens), and for those who use try-with-resources construct, having to keep a separate reference for the reader/stream is a pain. Although try-with-resources itself is Java 7+, the java.io.Closeable
interface is @since 1.5
, so implementing the interface can be done without losing Java 6 compatibility.