Repository navigation
Conversation
The runtime finds the ADAPTER field, fromValue(int), the built-in adapters, its own annotations and OneOf by name or by class identity. Apps that shrink their code had to write these rules themselves. The rules are now in the wire-runtime jar, and R8 and ProGuard read them from there.
This branch has not been deployed
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.
The
wire-runtimejar now contains R8 and ProGuard rules atMETA-INF/proguard/wire-runtime.pro.Apps that shrink their code no longer need to write rules for what the runtime finds by name or by class identity:
ADAPTERfield of each message, whichProtoAdapter.get(Class)reads.fromValue(int)method of each enum, whichRuntimeEnumAdaptercalls.ProtoAdapterand its built-in adapters, whichWireFieldandWireOneofFieldname in strings such ascom.squareup.wire.ProtoAdapter#STRING.WireField,WireOneofField,WireSealedOneof,WireBoxedOneofandWireEnumConstant.In R8 full mode, nothing implements them, so R8 can replace their methods with code that throws.
OneOf. Nothing creates one, so R8 can make it an empty class and merge the base class of a sealed oneof into it.The sealed oneof field then has the type
OneOf, and the reflective adapter throwsNoSuchFieldExceptionfor its<NAME>_KEYS.Cash App found this in its R8 builds.
WireEnclosingType, as that annotation's documentation asks.The Wire JSON docs now say that apps must keep the messages that they convert to JSON.
Wire cannot know which messages these are.