From cc8ca5b6a5478b40546d4206392eb1471454460d Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Mon, 19 Sep 2016 13:45:07 -0700 Subject: Integrate internal changes --- java/core/src/test/java/com/google/protobuf/TestUtil.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'java/core/src/test/java/com/google/protobuf/TestUtil.java') diff --git a/java/core/src/test/java/com/google/protobuf/TestUtil.java b/java/core/src/test/java/com/google/protobuf/TestUtil.java index d94f99e3..d4a18a22 100644 --- a/java/core/src/test/java/com/google/protobuf/TestUtil.java +++ b/java/core/src/test/java/com/google/protobuf/TestUtil.java @@ -232,12 +232,10 @@ import protobuf_unittest.UnittestProto.TestOneof2; import protobuf_unittest.UnittestProto.TestPackedExtensions; import protobuf_unittest.UnittestProto.TestPackedTypes; import protobuf_unittest.UnittestProto.TestUnpackedTypes; - -import junit.framework.Assert; - import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; +import junit.framework.Assert; /** * Contains methods for setting all fields of {@code TestAllTypes} to @@ -259,6 +257,13 @@ public final class TestUtil { return ByteString.copyFrom(str.getBytes(Internal.UTF_8)); } + /** + * Dirties the message by resetting the momoized serialized size. + */ + public static void resetMemoizedSize(AbstractMessage message) { + message.memoizedSize = -1; + } + /** * Get a {@code TestAllTypes} with all fields set as they would be by * {@link #setAllFields(TestAllTypes.Builder)}. -- cgit v1.2.3