3939public class JsonInput implements Closeable {
4040
4141 private final Reader source ;
42- // FIXME: This flag is never set
43- private final boolean readPerformed = false ;
42+ private boolean readPerformed = false ; // Changed from final
4443 private JsonTypeCoercer coercer ;
4544 private PropertySetting setter ;
4645 private final Input input ;
@@ -49,6 +48,7 @@ public class JsonInput implements Closeable {
4948 private final Deque <Container > stack = new ArrayDeque <>();
5049
5150 JsonInput (Reader source , JsonTypeCoercer coercer , PropertySetting setter ) {
51+
5252 this .source = Require .nonNull ("Source" , source );
5353 this .coercer = Require .nonNull ("Coercer" , coercer );
5454 this .input = new Input (source );
@@ -402,6 +402,10 @@ public void skipValue() {
402402 }
403403 }
404404
405+ private void markReadPerformed () {
406+ readPerformed = true ;
407+ }
408+
405409 /**
406410 * Read the next element from the JSON input stream as the specified type.
407411 *
@@ -413,15 +417,16 @@ public void skipValue() {
413417 * @throws UncheckedIOException if an I/O exception is encountered
414418 */
415419 public <T > T read (Type type ) {
420+ markReadPerformed ();
416421 skipWhitespace (input );
417422
418- // Guard against reading an empty stream
419423 if (input .peek () == Input .EOF ) {
420424 return null ;
421425 }
422426
423427 return coercer .coerce (this , type , setter );
424428 }
429+ }
425430
426431 /**
427432 * Read an array of elements from the JSON input stream with elements as the specified type.
0 commit comments