summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKweku Adams <kwekua@google.com>2015-01-13 11:58:16 -0800
committerJuan Silveira <jjso@google.com>2015-02-10 19:42:31 +0000
commit46fe64be0fc97ba82c8ac34f700b43a5e1a7653d (patch)
tree3221eb7ba977118e640903e7d09473e05815a769
parentaecce146f3b94732d08ca796eb402575be6fd930 (diff)
downloadexternal_protobuf-46fe64be0fc97ba82c8ac34f700b43a5e1a7653d.zip
external_protobuf-46fe64be0fc97ba82c8ac34f700b43a5e1a7653d.tar.gz
external_protobuf-46fe64be0fc97ba82c8ac34f700b43a5e1a7653d.tar.bz2
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
-rw-r--r--java/src/main/java/com/google/protobuf/nano/Extension.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/java/src/main/java/com/google/protobuf/nano/Extension.java b/java/src/main/java/com/google/protobuf/nano/Extension.java
index 42e6fad..27bab8c 100644
--- a/java/src/main/java/com/google/protobuf/nano/Extension.java
+++ b/java/src/main/java/com/google/protobuf/nano/Extension.java
@@ -74,6 +74,19 @@ public class Extension<M extends ExtendableMessageNano<M>, T> {
public static final int TYPE_SINT32 = 17;
public static final int TYPE_SINT64 = 18;
+ /**
+ * 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 <M extends ExtendableMessageNano<M>, T extends MessageNano>
+ Extension<M, T> createMessageTyped(int type, Class<T> clazz, int tag) {
+ return new Extension<M, T>(type, clazz, tag, false);
+ }
+
// 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