| 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,
|
|
|