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

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

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years 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/core/src/main/java/com/google/protobuf/ExtensionRegistry.java
diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ExtensionRegistry.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ExtensionRegistry.java
index 0067392fa6058b48ea26e18d9d54323e12399596..a22a74a03caeebacfaaca6705a87c53522274e62 100644
--- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ExtensionRegistry.java
+++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ExtensionRegistry.java
@@ -32,7 +32,6 @@ package com.google.protobuf;
import com.google.protobuf.Descriptors.Descriptor;
import com.google.protobuf.Descriptors.FieldDescriptor;
-
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -101,7 +100,7 @@ public class ExtensionRegistry extends ExtensionRegistryLite {
/** Get the unmodifiable singleton empty instance. */
public static ExtensionRegistry getEmptyRegistry() {
- return EMPTY;
+ return EMPTY_REGISTRY;
}
@@ -243,6 +242,11 @@ public class ExtensionRegistry extends ExtensionRegistryLite {
add(newExtensionInfo(extension), extension.getExtensionType());
}
+ /** Add an extension from a generated file to the registry. */
+ public void add(final GeneratedMessage.GeneratedExtension<?, ?> extension) {
+ add((Extension<?, ?>) extension);
+ }
+
static ExtensionInfo newExtensionInfo(final Extension<?, ?> extension) {
if (extension.getDescriptor().getJavaType() ==
FieldDescriptor.JavaType.MESSAGE) {
@@ -311,7 +315,7 @@ public class ExtensionRegistry extends ExtensionRegistryLite {
private final Map<DescriptorIntPair, ExtensionInfo> mutableExtensionsByNumber;
ExtensionRegistry(boolean empty) {
- super(ExtensionRegistryLite.getEmptyRegistry());
+ super(EMPTY_REGISTRY_LITE);
this.immutableExtensionsByName =
Collections.<String, ExtensionInfo>emptyMap();
this.mutableExtensionsByName =
@@ -321,7 +325,7 @@ public class ExtensionRegistry extends ExtensionRegistryLite {
this.mutableExtensionsByNumber =
Collections.<DescriptorIntPair, ExtensionInfo>emptyMap();
}
- private static final ExtensionRegistry EMPTY = new ExtensionRegistry(true);
+ static final ExtensionRegistry EMPTY_REGISTRY = new ExtensionRegistry(true);
private void add(
final ExtensionInfo extension,

Powered by Google App Engine
This is Rietveld 408576698