Repository navigation
feat: add enum, size limit and handle types - #16
Merged
Merged
Conversation
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.
What changed
Three additions to
Type, written in the existing text form so older type strings still read the same:enum<a|b>: a string that is one of the listed values.string[..100],int[0..100],list<T>[1..],map<T>[..5],bytes[..1024]. It limits the length of a string, bytes, list or map, or the value of an int or double. Either end may be left out, and it combines with?and with item types.handle<kind>: a string that names something the host keeps for the plugin, such as a message token.conformlooks through a limit.fitstreats the new types as equal-only, like the other non-structural types.Why
Type.ANYand unbounded strings and lists leave the size of what crosses the boundary to the receiver. Limits and enums let a spec say it, andhandlelets the host find token fields from the spec instead of a hard-coded list (a follow-up in MessengerBotR).Compatibility
The protocol version is still 0, so it is not raised. A peer built before this change cannot read the new type text. Raise the protocol version when the first release ships.
Testing
:contract:testand:tck:testpass, including seven new cases for the text form, malformed text, enums, limits, nested limits, handles andconform.:android:testDebugUnitTestfails here withUnsupported class file major version 70because of the newer JDK, and fails the same way on an unchanged master.