Skip to content

Add getExtensionRegistry() getter to ProtoLiteUtils and ProtoUtils (#3836) [fj4WqyCCw3C5ShR1RfB7MoBPTpkRrBFYP1uT35g3MvT] - #12940

Open
waterWang wants to merge 1 commit into
grpc:masterfrom
waterWang:fix-3836-extension-registry-getter
Open

Add getExtensionRegistry() getter to ProtoLiteUtils and ProtoUtils (#3836) [fj4WqyCCw3C5ShR1RfB7MoBPTpkRrBFYP1uT35g3MvT]#12940
waterWang wants to merge 1 commit into
grpc:masterfrom
waterWang:fix-3836-extension-registry-getter

Conversation

@waterWang

Copy link
Copy Markdown

Description

The ProtoLiteUtils.setExtensionRegistry() setter was added in gRPC 1.0.0, but there was no corresponding getter. This made it impossible for the reflection service or other components to discover the extensions that were registered via the global ExtensionRegistry.

Changes

  1. ProtoLiteUtils.java: Added getExtensionRegistry() returning ExtensionRegistryLite - the global registry stored in the package-private globalRegistry field.

  2. ProtoUtils.java: Added getExtensionRegistry() returning ExtensionRegistry - delegating to ProtoLiteUtils.getExtensionRegistry() with a cast, since ExtensionRegistry extends ExtensionRegistryLite.

Related Issue

Fixes #3836 - Reflection service does not consult ExtensionRegistry

Note

This is the first step (the getter). The reflection service can now use ProtoUtils.getExtensionRegistry() to discover programmatically registered extensions that are not in the FileDescriptor graph. A follow-up can update ProtoReflectionServiceV1.FileDescriptorIndex to also consult the global registry.

…rpc#3836)

The ProtoLiteUtils.setExtensionRegistry() setter was added in
gRPC 1.0.0, but there was no corresponding getter. This made it
impossible for the reflection service or other components to
discover the extensions that were registered via the global
ExtensionRegistry.

Add getExtensionRegistry() to both ProtoLiteUtils (returns
ExtensionRegistryLite) and ProtoUtils (returns ExtensionRegistry
with a cast) so that the global registry can be read back.

Issue: grpc#3836
@linux-foundation-easycla

Copy link
Copy Markdown

CLA Not Signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reflection service does not consult ExtensionRegistry

1 participant