Draft
Conversation
d7c397b to
7da5c16
Compare
defaulting to proto2 behavior
fd94792 to
a305de2
Compare
swankjesse
reviewed
Jul 2, 2024
| PROTO_2("proto2"), | ||
| PROTO_3("proto3"), | ||
| ; | ||
| /** Syntax and edition version. */ |
Collaborator
There was a problem hiding this comment.
It has nothing to do with your PR, but I just completely hate this design decision in protobuf. What a disaster for authors and readers of protobuf.
| PROTO_3("proto3"), | ||
| ; | ||
| /** Syntax and edition version. */ | ||
| sealed class Syntax(internal val string: String) { |
Collaborator
There was a problem hiding this comment.
I’m tempted to say we create a new thing, Syntax2 or something, that offers these things, and keep Syntax as-is? Making a big binary-incompatible change to wire-runtime has a potentially large user impact?
(Why is Syntax in the runtime API?)
Member
Author
There was a problem hiding this comment.
Because it's passed as a parameter to adapters
expect abstract class ProtoAdapter<E>(
fieldEncoding: FieldEncoding,
type: KClass<*>?,
typeUrl: String?,
syntax: Syntax,
identity: E? = null,
sourceFile: String? = null,
) {| // Created for backward capability with when Syntax used to be an enum. | ||
| fun name(): String { | ||
| return when (this) { | ||
| // TODO(Benoit) Edition needs to return something like `Edition(<value>)`. |
Collaborator
There was a problem hiding this comment.
Yeah, yuck. Anything calling this might not be able to parse it later
| } | ||
|
|
||
| @Test | ||
| fun rejectUnknownEditions() { |
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.
defaulting to proto2 behavior, which is kinda wrong.
The way we break the world for Java callers is very sad...
Maybe we could just manually increate the enum values one bye one each year...