Skip to content

Commit c40ef05

Browse files
committed
Bit more 3.0-proof-renaming for internal context members
1 parent 70130be commit c40ef05

File tree

7 files changed

+124
-126
lines changed

7 files changed

+124
-126
lines changed

cbor/src/main/java/com/fasterxml/jackson/dataformat/cbor/CBORGenerator.java

+30-32
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,9 @@ public int getMask() {
166166
/**********************************************************
167167
*/
168168

169-
/**
170-
* @since 2.10
171-
*/
172-
protected CBORWriteContext _cborContext;
173-
169+
// @since 2.10 (named _cborContext before 2.13)
170+
protected CBORWriteContext _streamWriteContext;
171+
174172
/*
175173
/**********************************************************
176174
/* Output buffering
@@ -251,7 +249,7 @@ public CBORGenerator(IOContext ctxt, int stdFeatures, int formatFeatures,
251249
? DupDetector.rootDetector(this)
252250
: null;
253251
// NOTE: we passed `null` for default write context
254-
_cborContext = CBORWriteContext.createRootContext(dups);
252+
_streamWriteContext = CBORWriteContext.createRootContext(dups);
255253
_formatFeatures = formatFeatures;
256254
_cfgMinimalInts = Feature.WRITE_MINIMAL_INTS.enabledIn(formatFeatures);
257255
_ioContext = ctxt;
@@ -286,7 +284,7 @@ public CBORGenerator(IOContext ctxt, int stdFeatures, int formatFeatures,
286284
? DupDetector.rootDetector(this)
287285
: null;
288286
// NOTE: we passed `null` for default write context
289-
_cborContext = CBORWriteContext.createRootContext(dups);
287+
_streamWriteContext = CBORWriteContext.createRootContext(dups);
290288
_formatFeatures = formatFeatures;
291289
_cfgMinimalInts = Feature.WRITE_MINIMAL_INTS.enabledIn(formatFeatures);
292290
_ioContext = ctxt;
@@ -402,27 +400,27 @@ public JsonGenerator overrideFormatFeatures(int values, int mask) {
402400

403401
@Override // since 2.13
404402
public Object currentValue() {
405-
return _cborContext.getCurrentValue();
403+
return _streamWriteContext.getCurrentValue();
406404
}
407405

408406
@Override
409407
public Object getCurrentValue() {
410-
return _cborContext.getCurrentValue();
408+
return _streamWriteContext.getCurrentValue();
411409
}
412410

413411
@Override
414412
public void assignCurrentValue(Object v) {
415-
_cborContext.setCurrentValue(v);
413+
_streamWriteContext.setCurrentValue(v);
416414
}
417415

418416
@Override
419417
public void setCurrentValue(Object v) {
420-
_cborContext.setCurrentValue(v);
418+
_streamWriteContext.setCurrentValue(v);
421419
}
422420

423421
@Override
424422
public JsonStreamContext getOutputContext() {
425-
return _cborContext;
423+
return _streamWriteContext;
426424
}
427425

428426
/*
@@ -472,7 +470,7 @@ public CBORGenerator configure(Feature f, boolean state) {
472470

473471
@Override
474472
public final void writeFieldName(String name) throws IOException {
475-
if (!_cborContext.writeFieldName(name)) {
473+
if (!_streamWriteContext.writeFieldName(name)) {
476474
_reportError("Can not write a field name, expecting a value");
477475
}
478476
_writeString(name);
@@ -482,7 +480,7 @@ public final void writeFieldName(String name) throws IOException {
482480
public final void writeFieldName(SerializableString name)
483481
throws IOException {
484482
// Object is a value, need to verify it's allowed
485-
if (!_cborContext.writeFieldName(name.getValue())) {
483+
if (!_streamWriteContext.writeFieldName(name.getValue())) {
486484
_reportError("Can not write a field name, expecting a value");
487485
}
488486
byte[] raw = name.asUnquotedUTF8();
@@ -497,7 +495,7 @@ public final void writeFieldName(SerializableString name)
497495

498496
@Override // since 2.8
499497
public final void writeFieldId(long id) throws IOException {
500-
if (!_cborContext.writeFieldId(id)) {
498+
if (!_streamWriteContext.writeFieldId(id)) {
501499
_reportError("Can not write a field id, expecting a value");
502500
}
503501
_writeLongNoCheck(id);
@@ -548,7 +546,7 @@ protected void maybeCopyTag(JsonParser p) throws IOException {
548546
@Override
549547
public final void writeStartArray() throws IOException {
550548
_verifyValueWrite("start an array");
551-
_cborContext = _cborContext.createChildArrayContext(null);
549+
_streamWriteContext = _streamWriteContext.createChildArrayContext(null);
552550
if (_elementCountsPtr > 0) {
553551
_pushRemainingElements();
554552
}
@@ -559,7 +557,7 @@ public final void writeStartArray() throws IOException {
559557
@Override // since 2.12
560558
public void writeStartArray(Object forValue) throws IOException {
561559
_verifyValueWrite("start an array");
562-
_cborContext = _cborContext.createChildArrayContext(forValue);
560+
_streamWriteContext = _streamWriteContext.createChildArrayContext(forValue);
563561
if (_elementCountsPtr > 0) {
564562
_pushRemainingElements();
565563
}
@@ -574,7 +572,7 @@ public void writeStartArray(Object forValue) throws IOException {
574572
@Override // since 2.12
575573
public void writeStartArray(Object forValue, int elementsToWrite) throws IOException {
576574
_verifyValueWrite("start an array");
577-
_cborContext = _cborContext.createChildArrayContext(forValue);
575+
_streamWriteContext = _streamWriteContext.createChildArrayContext(forValue);
578576
_pushRemainingElements();
579577
_currentRemainingElements = elementsToWrite;
580578
_writeLengthMarker(PREFIX_TYPE_ARRAY, elementsToWrite);
@@ -584,25 +582,25 @@ public void writeStartArray(Object forValue, int elementsToWrite) throws IOExcep
584582
@Override
585583
public void writeStartArray(int elementsToWrite) throws IOException {
586584
_verifyValueWrite("start an array");
587-
_cborContext = _cborContext.createChildArrayContext(null);
585+
_streamWriteContext = _streamWriteContext.createChildArrayContext(null);
588586
_pushRemainingElements();
589587
_currentRemainingElements = elementsToWrite;
590588
_writeLengthMarker(PREFIX_TYPE_ARRAY, elementsToWrite);
591589
}
592590

593591
@Override
594592
public final void writeEndArray() throws IOException {
595-
if (!_cborContext.inArray()) {
596-
_reportError("Current context not Array but "+_cborContext.typeDesc());
593+
if (!_streamWriteContext.inArray()) {
594+
_reportError("Current context not Array but "+_streamWriteContext.typeDesc());
597595
}
598596
closeComplexElement();
599-
_cborContext = _cborContext.getParent();
597+
_streamWriteContext = _streamWriteContext.getParent();
600598
}
601599

602600
@Override
603601
public final void writeStartObject() throws IOException {
604602
_verifyValueWrite("start an object");
605-
_cborContext = _cborContext.createChildObjectContext(null);
603+
_streamWriteContext = _streamWriteContext.createChildObjectContext(null);
606604
if (_elementCountsPtr > 0) {
607605
_pushRemainingElements();
608606
}
@@ -614,8 +612,8 @@ public final void writeStartObject() throws IOException {
614612
// since 2.8
615613
public final void writeStartObject(Object forValue) throws IOException {
616614
_verifyValueWrite("start an object");
617-
CBORWriteContext ctxt = _cborContext.createChildObjectContext(forValue);
618-
_cborContext = ctxt;
615+
CBORWriteContext ctxt = _streamWriteContext.createChildObjectContext(forValue);
616+
_streamWriteContext = ctxt;
619617
if (_elementCountsPtr > 0) {
620618
_pushRemainingElements();
621619
}
@@ -625,19 +623,19 @@ public final void writeStartObject(Object forValue) throws IOException {
625623

626624
public final void writeStartObject(int elementsToWrite) throws IOException {
627625
_verifyValueWrite("start an object");
628-
_cborContext = _cborContext.createChildObjectContext(null);
626+
_streamWriteContext = _streamWriteContext.createChildObjectContext(null);
629627
_pushRemainingElements();
630628
_currentRemainingElements = elementsToWrite;
631629
_writeLengthMarker(PREFIX_TYPE_OBJECT, elementsToWrite);
632630
}
633631

634632
@Override
635633
public final void writeEndObject() throws IOException {
636-
if (!_cborContext.inObject()) {
637-
_reportError("Current context not Object but "+ _cborContext.typeDesc());
634+
if (!_streamWriteContext.inObject()) {
635+
_reportError("Current context not Object but "+ _streamWriteContext.typeDesc());
638636
}
639637
closeComplexElement();
640-
_cborContext = _cborContext.getParent();
638+
_streamWriteContext = _streamWriteContext.getParent();
641639
}
642640

643641
@Override // since 2.8
@@ -1173,7 +1171,7 @@ public void writeNumber(String encodedValue) throws IOException,
11731171

11741172
@Override
11751173
protected final void _verifyValueWrite(String typeMsg) throws IOException {
1176-
if (!_cborContext.writeValue()) {
1174+
if (!_streamWriteContext.writeValue()) {
11771175
_reportError("Can not " + typeMsg + ", expecting field name/id");
11781176
}
11791177
// decrementElementsRemainingCount()
@@ -1195,7 +1193,7 @@ protected final void _verifyValueWrite(String typeMsg) throws IOException {
11951193
private void _failSizedArrayOrObject() throws IOException
11961194
{
11971195
_reportError(String.format("%s size mismatch: number of element encoded is not equal to reported array/map size.",
1198-
_cborContext.typeDesc()));
1196+
_streamWriteContext.typeDesc()));
11991197
}
12001198

12011199
/*
@@ -1784,7 +1782,7 @@ private final void closeComplexElement() throws IOException {
17841782
break;
17851783
default:
17861784
_reportError(String.format("%s size mismatch: expected %d more elements",
1787-
_cborContext.typeDesc(), _currentRemainingElements));
1785+
_streamWriteContext.typeDesc(), _currentRemainingElements));
17881786
}
17891787
_currentRemainingElements = (_elementCountsPtr == 0)
17901788
? INDEFINITE_LENGTH

protobuf/src/main/java/com/fasterxml/jackson/dataformat/protobuf/ProtobufParser.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public class ProtobufParser extends ParserMinimalBase
7979
* I/O context for this reader. It handles buffer allocation
8080
* for the reader.
8181
*/
82-
final protected IOContext _ioContext;
82+
protected final IOContext _ioContext;
8383

8484
/**
8585
* Flag that indicates whether parser is closed or not. Gets

0 commit comments

Comments
 (0)