Internal change

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

@ -223,13 +223,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;
}
}
}
// -----------------------------------------------------------------
@ -699,26 +721,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
@ -1411,26 +1413,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
@ -2176,26 +2158,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;
@ -3307,26 +3269,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

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

@ -98,5 +98,6 @@ message ReservedAsMapFieldWithEnumValue {
// https://github.com/protocolbuffers/protobuf/issues/9785
message MapContainer {
map<string,string> my_map = 1;
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