Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1800)

Unified Diff: third_party/protobuf/java/src/main/java/com/google/protobuf/Extension.java

Issue 1842653006: Update //third_party/protobuf to version 3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/java/src/main/java/com/google/protobuf/Extension.java
diff --git a/third_party/protobuf/src/google/protobuf/unittest_mset.proto b/third_party/protobuf/java/src/main/java/com/google/protobuf/Extension.java
similarity index 52%
copy from third_party/protobuf/src/google/protobuf/unittest_mset.proto
copy to third_party/protobuf/java/src/main/java/com/google/protobuf/Extension.java
index 3497f09fa6d41b7b38357e7f2610dfb5c087d3e4..68d29f33d47b43ffaa1253903a5e12b1c3bb6f41 100644
--- a/third_party/protobuf/src/google/protobuf/unittest_mset.proto
+++ b/third_party/protobuf/java/src/main/java/com/google/protobuf/Extension.java
@@ -1,6 +1,6 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
+// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -28,45 +28,58 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Author: kenton@google.com (Kenton Varda)
-// Based on original Protocol Buffers design by
-// Sanjay Ghemawat, Jeff Dean, and others.
-//
-// This file contains messages for testing message_set_wire_format.
+package com.google.protobuf;
-package protobuf_unittest;
+/**
+ * Interface that generated extensions implement.
+ *
+ * @author liujisi@google.com (Jisi Liu)
+ */
+public abstract class Extension<ContainingType extends MessageLite, Type>
+ extends ExtensionLite<ContainingType, Type> {
-option optimize_for = SPEED;
+ /** Returns the descriptor of the extension. */
+ public abstract Descriptors.FieldDescriptor getDescriptor();
-// A message with message_set_wire_format.
-message TestMessageSet {
- option message_set_wire_format = true;
- extensions 4 to max;
-}
+ /** Returns whether or not this extension is a Lite Extension. */
+ final boolean isLite() {
+ return false;
+ }
-message TestMessageSetContainer {
- optional TestMessageSet message_set = 1;
-}
+ // All the methods below are extension implementation details.
-message TestMessageSetExtension1 {
- extend TestMessageSet {
- optional TestMessageSetExtension1 message_set_extension = 1545008;
+ /**
+ * The API type that the extension is used for.
+ */
+ protected enum ExtensionType {
+ IMMUTABLE,
+ MUTABLE,
+ PROTO1,
}
- optional int32 i = 15;
-}
-message TestMessageSetExtension2 {
- extend TestMessageSet {
- optional TestMessageSetExtension2 message_set_extension = 1547769;
+ protected ExtensionType getExtensionType() {
+ // TODO(liujisi): make this abstract after we fix proto1.
+ return ExtensionType.IMMUTABLE;
}
- optional string str = 25;
-}
-// MessageSet wire format is equivalent to this.
-message RawMessageSet {
- repeated group Item = 1 {
- required int32 type_id = 2;
- required bytes message = 3;
+ /**
+ * Type of a message extension.
+ */
+ public enum MessageType {
+ PROTO1,
+ PROTO2,
+ }
+
+ /**
+ * If the extension is a message extension (i.e., getLiteType() == MESSAGE),
+ * returns the type of the message, otherwise undefined.
+ */
+ public MessageType getMessageType() {
+ return MessageType.PROTO2;
}
-}
+ protected abstract Object fromReflectionType(Object value);
+ protected abstract Object singularFromReflectionType(Object value);
+ protected abstract Object toReflectionType(Object value);
+ protected abstract Object singularToReflectionType(Object value);
+}

Powered by Google App Engine
This is Rietveld 408576698