-
Notifications
You must be signed in to change notification settings - Fork 667
Fix ProtoBuf packing for kotlin unsigned types #3079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
…s can be packed. inline popTag -> popTagOrDefault is needed, because packed serializer will use MISSING_TAG for entries, popTag fails on that.
|
Before moving further with this PR (for the part where inline value classes support is fixed) we need to address the questions from #3045 (comment) |
|
Okay, I'm not a Kotlin maintainer or anything, but here are my thoughts:
As long as value classes use their default serializer, I think, they should be inlined completely: And, if for some reason, I do not want to serialize the value class this way, I can still go the long way, and write a custom serializer, or maybe we can add an annotation for serializable value classes (like DontInlineSerialize) If we want to match standards/specifications exactly, don't bend protobuf's rules, maybe do the inlining the opposite way: inline only for unsigned primitives, and for explicit SerializeInline annotation. Currently we try to inline things in all formats.
The way I edited the
If the value class is inlined, I would look for these annotations recursively, from the deepest. On the implementation question, I have some ideas, but nothing precise-enough, and I think it would be better to have the complete specification first, maybe involve more people, ask what their thoughts are. |
|
Hi @KosmX! I think we can merge this without solving all the issues mentioned. Do you want to continue working with this PR? If so, I'll submit my portion of comments |
ProtoBuf's
ProtoPackedannotation only worked for the original signed primitives and ByteArray, and did not work for unsigned variants.