Internal change

PiperOrigin-RevId: 663919912
pull/18385/head
Protobuf Team Bot 6 months ago committed by Sandy Zhang
parent 5b0e54384a
commit 50a7745a4a
  1. 106
      java/core/src/main/java/com/google/protobuf/CodedInputStream.java
  2. 1
      java/core/src/test/proto/com/google/protobuf/map_lite_test.proto
  3. 1
      java/core/src/test/proto/com/google/protobuf/map_test.proto
  4. 1
      java/lite/src/test/java/com/google/protobuf/LiteTest.java

@ -224,13 +224,35 @@ public abstract class CodedInputStream {
* Reads and discards an entire message. This will read either until EOF or until an endgroup tag,
* whichever comes first.
*/
public abstract void skipMessage() throws IOException;
public void skipMessage() throws IOException {
while (true) {
final int tag = readTag();
if (tag == 0) {
return;
}
boolean fieldSkipped = skipField(tag);
if (!fieldSkipped) {
return;
}
}
}
/**
* Reads an entire message and writes it to output in wire format. This will read either until EOF
* or until an endgroup tag, whichever comes first.
*/
public abstract void skipMessage(CodedOutputStream output) throws IOException;
public void skipMessage(CodedOutputStream output) throws IOException {
while (true) {
final int tag = readTag();
if (tag == 0) {
return;
}
boolean fieldSkipped = skipField(tag, output);
if (!fieldSkipped) {
return;
}
}
}
// -----------------------------------------------------------------
@ -700,26 +722,6 @@ public abstract class CodedInputStream {
}
}
@Override
public void skipMessage() throws IOException {
while (true) {
final int tag = readTag();
if (tag == 0 || !skipField(tag)) {
return;
}
}
}
@Override
public void skipMessage(CodedOutputStream output) throws IOException {
while (true) {
final int tag = readTag();
if (tag == 0 || !skipField(tag, output)) {
return;
}
}
}
// -----------------------------------------------------------------
@Override
@ -1412,26 +1414,6 @@ public abstract class CodedInputStream {
}
}
@Override
public void skipMessage() throws IOException {
while (true) {
final int tag = readTag();
if (tag == 0 || !skipField(tag)) {
return;
}
}
}
@Override
public void skipMessage(CodedOutputStream output) throws IOException {
while (true) {
final int tag = readTag();
if (tag == 0 || !skipField(tag, output)) {
return;
}
}
}
// -----------------------------------------------------------------
@Override
@ -2178,26 +2160,6 @@ public abstract class CodedInputStream {
}
}
@Override
public void skipMessage() throws IOException {
while (true) {
final int tag = readTag();
if (tag == 0 || !skipField(tag)) {
return;
}
}
}
@Override
public void skipMessage(CodedOutputStream output) throws IOException {
while (true) {
final int tag = readTag();
if (tag == 0 || !skipField(tag, output)) {
return;
}
}
}
/** Collects the bytes skipped and returns the data in a ByteBuffer. */
private class SkippedDataSink implements RefillCallback {
private int lastPos = pos;
@ -3325,26 +3287,6 @@ public abstract class CodedInputStream {
}
}
@Override
public void skipMessage() throws IOException {
while (true) {
final int tag = readTag();
if (tag == 0 || !skipField(tag)) {
return;
}
}
}
@Override
public void skipMessage(CodedOutputStream output) throws IOException {
while (true) {
final int tag = readTag();
if (tag == 0 || !skipField(tag, output)) {
return;
}
}
}
// -----------------------------------------------------------------
@Override

@ -115,4 +115,5 @@ message ReservedAsMapFieldWithEnumValue {
// https://github.com/protocolbuffers/protobuf/issues/9785
message MapContainer {
map<string, string> my_map = 1;
map<uint32, string> m = 3;
}

@ -114,4 +114,5 @@ message ReservedAsMapFieldWithEnumValue {
// https://github.com/protocolbuffers/protobuf/issues/9785
message MapContainer {
map<string, string> my_map = 1;
map<uint32, string> m = 3;
}

@ -29,6 +29,7 @@ import com.google.protobuf.UnittestLite.TestAllTypesLiteOrBuilder;
import com.google.protobuf.UnittestLite.TestHugeFieldNumbersLite;
import com.google.protobuf.UnittestLite.TestNestedExtensionLite;
import com.google.protobuf.testing.Proto3TestingLite.Proto3MessageLite;
import map_lite_test.MapTestProto.MapContainer;
import map_lite_test.MapTestProto.TestMap;
import map_lite_test.MapTestProto.TestMap.MessageValue;
import protobuf_unittest.NestedExtensionLite;

Loading…
Cancel
Save