Add getExtensionRegistry() getter to ProtoLiteUtils and ProtoUtils (#3836) [fj4WqyCCw3C5ShR1RfB7MoBPTpkRrBFYP1uT35g3MvT] - #12940
Open
waterWang wants to merge 1 commit into
Conversation
…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
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 globalExtensionRegistry.Changes
ProtoLiteUtils.java: Added
getExtensionRegistry()returningExtensionRegistryLite- the global registry stored in the package-privateglobalRegistryfield.ProtoUtils.java: Added
getExtensionRegistry()returningExtensionRegistry- delegating toProtoLiteUtils.getExtensionRegistry()with a cast, sinceExtensionRegistryextendsExtensionRegistryLite.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 theFileDescriptorgraph. A follow-up can updateProtoReflectionServiceV1.FileDescriptorIndexto also consult the global registry.