diff options
Diffstat (limited to 'third_party/protobuf/3.2.0/java/core/src/main/java/com/google/protobuf/Internal.java')
-rw-r--r-- | third_party/protobuf/3.2.0/java/core/src/main/java/com/google/protobuf/Internal.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/third_party/protobuf/3.2.0/java/core/src/main/java/com/google/protobuf/Internal.java b/third_party/protobuf/3.2.0/java/core/src/main/java/com/google/protobuf/Internal.java index c234559ce3..36bdece306 100644 --- a/third_party/protobuf/3.2.0/java/core/src/main/java/com/google/protobuf/Internal.java +++ b/third_party/protobuf/3.2.0/java/core/src/main/java/com/google/protobuf/Internal.java @@ -62,6 +62,16 @@ public final class Internal { /** * Throws an appropriate {@link NullPointerException} if the given objects is {@code null}. */ + static <T> T checkNotNull(T obj) { + if (obj == null) { + throw new NullPointerException(); + } + return obj; + } + + /** + * Throws an appropriate {@link NullPointerException} if the given objects is {@code null}. + */ static <T> T checkNotNull(T obj, String message) { if (obj == null) { throw new NullPointerException(message); @@ -420,6 +430,11 @@ public final class Internal { CodedInputStream.newInstance(EMPTY_BYTE_ARRAY); + /** Helper method to merge two MessageLite instances. */ + static Object mergeMessage(Object destination, Object source) { + return ((MessageLite) destination).toBuilder().mergeFrom((MessageLite) source).buildPartial(); + } + /** * Provides an immutable view of {@code List<T>} around a {@code List<F>}. * |