@@ -354,7 +354,7 @@ public JsonToken nextToken() throws JacksonException
354
354
if (evt == null ) {
355
355
_currentAnchor = Optional .empty ();
356
356
_lastTagEvent = null ;
357
- return ( _currToken = null );
357
+ return _updateTokenToNull ( );
358
358
}
359
359
_lastEvent = evt ;
360
360
// One complication: property names are only inferred from the fact that we are
@@ -371,7 +371,7 @@ public JsonToken nextToken() throws JacksonException
371
371
_reportMismatchedEndMarker ('}' , ']' );
372
372
}
373
373
_streamReadContext = _streamReadContext .getParent ();
374
- return ( _currToken = JsonToken .END_OBJECT );
374
+ return _updateToken ( JsonToken .END_OBJECT );
375
375
}
376
376
_reportError ("Expected a property name (Scalar value in YAML), got this instead: " +evt );
377
377
}
@@ -396,7 +396,7 @@ public JsonToken nextToken() throws JacksonException
396
396
final String name = scalar .getValue ();
397
397
_currentName = name ;
398
398
_streamReadContext .setCurrentName (name );
399
- return ( _currToken = JsonToken .PROPERTY_NAME );
399
+ return _updateToken ( JsonToken .PROPERTY_NAME );
400
400
}
401
401
} else if (_streamReadContext .inArray ()) {
402
402
_streamReadContext .valueRead ();
@@ -409,8 +409,7 @@ public JsonToken nextToken() throws JacksonException
409
409
case Scalar :
410
410
// scalar values are probably the commonest:
411
411
JsonToken t = _decodeScalar ((ScalarEvent ) evt );
412
- _currToken = t ;
413
- return t ;
412
+ return _updateToken (t );
414
413
case MappingStart :
415
414
// followed by maps, then arrays
416
415
Optional <Mark > m = evt .getStartMark ();
@@ -419,7 +418,7 @@ public JsonToken nextToken() throws JacksonException
419
418
_streamReadContext = _streamReadContext .createChildObjectContext (
420
419
m .map (mark -> mark .getLine ()).orElse (0 ), m .map (mark -> mark .getColumn ()).orElse (0 ));
421
420
_streamReadConstraints .validateNestingDepth (_streamReadContext .getNestingDepth ());
422
- return ( _currToken = JsonToken .START_OBJECT );
421
+ return _updateToken ( JsonToken .START_OBJECT );
423
422
424
423
case MappingEnd :
425
424
// actually error; can not have map-end here
@@ -431,21 +430,21 @@ public JsonToken nextToken() throws JacksonException
431
430
_streamReadContext = _streamReadContext .createChildArrayContext (
432
431
mrk .map (mark -> mark .getLine ()).orElse (0 ), mrk .map (mark -> mark .getColumn ()).orElse (0 ));
433
432
_streamReadConstraints .validateNestingDepth (_streamReadContext .getNestingDepth ());
434
- return ( _currToken = JsonToken .START_ARRAY );
433
+ return _updateToken ( JsonToken .START_ARRAY );
435
434
436
435
case SequenceEnd :
437
436
if (!_streamReadContext .inArray ()) { // sanity check is optional, but let's do it for now
438
437
_reportMismatchedEndMarker (']' , '}' );
439
438
}
440
439
_streamReadContext = _streamReadContext .getParent ();
441
- return ( _currToken = JsonToken .END_ARRAY );
440
+ return _updateToken ( JsonToken .END_ARRAY );
442
441
443
442
// after this, less common tokens:
444
443
case DocumentEnd :
445
444
// [dataformat-yaml#72]: logical end of doc; fine. Two choices; either skip,
446
445
// or return null as marker (but do NOT close). Earlier returned `null`, but
447
446
// to allow multi-document reading should actually just skip.
448
- // return (_currToken = null );
447
+ // return _updateTokenToNull( );
449
448
continue ;
450
449
451
450
case DocumentStart :
@@ -459,12 +458,12 @@ public JsonToken nextToken() throws JacksonException
459
458
_textValue = alias .getAnchor ().orElseThrow (() -> new RuntimeException ("Alias must be provided." )).getValue ();
460
459
_cleanedTextValue = null ;
461
460
// for now, nothing to do: in future, maybe try to expose as ObjectIds?
462
- return ( _currToken = JsonToken .VALUE_STRING );
461
+ return _updateToken ( JsonToken .VALUE_STRING );
463
462
464
463
case StreamEnd :
465
464
// end-of-input; force closure
466
465
close ();
467
- return ( _currToken = null );
466
+ return _updateTokenToNull ( );
468
467
469
468
case StreamStart :
470
469
// useless, skip
0 commit comments