From 2712c421362994b4617e865ff977cc1c8f37f3d0 Mon Sep 17 00:00:00 2001 From: Kweku Adams Date: Tue, 13 Jan 2015 11:58:16 -0800 Subject: DO NOT MERGE Overloading createMessageTyped to accept a tag as an integer. When building, some instances expect createMessageTyped to have the signature (int, Class, long), while others expect (int, Class, int). Simply having the former signature meant that builds expecting the latter would fail. This is a cherrypick of change b2a9d4321578139677c146ce37eba5e27e8f5c79 from master. Change-Id: Ib02dbf66173510f4edea32c7b43e82c1a7a38aa2 --- .../src/main/java/com/google/protobuf/nano/Extension.java | 13 +++++++++++++ .../main/java/com/google/protobuf/nano/Extension.java.rej | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 javanano/src/main/java/com/google/protobuf/nano/Extension.java.rej (limited to 'javanano/src/main/java/com/google') diff --git a/javanano/src/main/java/com/google/protobuf/nano/Extension.java b/javanano/src/main/java/com/google/protobuf/nano/Extension.java index 10634766..c458f9b1 100644 --- a/javanano/src/main/java/com/google/protobuf/nano/Extension.java +++ b/javanano/src/main/java/com/google/protobuf/nano/Extension.java @@ -74,6 +74,19 @@ public class Extension, T> { public static final int TYPE_SINT32 = InternalNano.TYPE_SINT32; public static final int TYPE_SINT64 = InternalNano.TYPE_SINT64; + /** + * Creates an {@code Extension} of the given message type and tag number. + * Should be used by the generated code only. + * + * @param type {@link #TYPE_MESSAGE} or {@link #TYPE_GROUP} + * @deprecated use {@link #createMessageTyped(int, Class, long)} instead. + */ + @Deprecated + public static , T extends MessageNano> + Extension createMessageTyped(int type, Class clazz, int tag) { + return new Extension(type, clazz, tag, false); + } + // Note: these create...() methods take a long for the tag parameter, // because tags are represented as unsigned ints, and these values exist // in generated code as long values. However, they can fit in 32-bits, so diff --git a/javanano/src/main/java/com/google/protobuf/nano/Extension.java.rej b/javanano/src/main/java/com/google/protobuf/nano/Extension.java.rej deleted file mode 100644 index 465495a7..00000000 --- a/javanano/src/main/java/com/google/protobuf/nano/Extension.java.rej +++ /dev/null @@ -1,13 +0,0 @@ -diff a/javanano/src/main/java/com/google/protobuf/nano/Extension.java b/javanano/src/main/java/com/google/protobuf/nano/Extension.java (rejected hunks) -@@ -74,6 +74,11 @@ public class Extension, T> { - public static final int TYPE_SINT32 = 17; - public static final int TYPE_SINT64 = 18; - -+ // Note: these create...() methods take a long for the tag parameter, -+ // because tags are represented as unsigned longs, and these values exist -+ // in generated code as long values. However, they can fit in 32-bits, so -+ // it's safe to cast them to int without loss of precision. -+ - /** - * Creates an {@code Extension} of the given message type and tag number. - * Should be used by the generated code only. -- cgit v1.2.3