Converting between native objective-c proto and j2cl protos

56 views
Skip to first unread message

Dennis Liang

unread,
Feb 3, 2022, 6:05:14 PM2/3/22
to j2objc-discuss
What's the correct way to convert between between native objective-c protos and j2cl protos (and vice versa)?

Right now I'm just taking the NSData and calling parseFromNSData. However I noticed that proto extensions are getting dropped.

Tom Ball

unread,
Feb 4, 2022, 1:01:07 PM2/4/22
to j2objc-...@googlegroups.com
The correct way to convert between any different protobuf implementations is to serialize from one using toByteArray() and parse that result using parseFrom(). Generally, one should never assume anything about any protobuf implementation's internal data representation, and instead only rely on the common public API.

On Thu, Feb 3, 2022 at 3:05 PM 'Dennis Liang' via j2objc-discuss <j2objc-...@googlegroups.com> wrote:
What's the correct way to convert between between native objective-c protos and j2cl protos (and vice versa)?

Right now I'm just taking the NSData and calling parseFromNSData. However I noticed that proto extensions are getting dropped.

--
You received this message because you are subscribed to the Google Groups "j2objc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to j2objc-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/j2objc-discuss/740f1a68-4c08-4637-8763-035d01dd14e7n%40googlegroups.com.

Dennis Liang

unread,
Feb 4, 2022, 1:12:36 PM2/4/22
to j2objc-...@googlegroups.com
Yeah, that is what I used [J2CLProto parseFrom:objcProto.data], but it caused the extension fields to be dropped.
Anyways I think figured it out, I ended up using [J2CLProto parseFromNSData:registry:] call and that seems to have worked.

You received this message because you are subscribed to a topic in the Google Groups "j2objc-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/j2objc-discuss/pcr79UqsiSQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to j2objc-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/j2objc-discuss/CAPLadK4_Xyy7VobYDk5MUexmeMzVWCxn6Etrgxgb0Fsh5ihN0Q%40mail.gmail.com.

Tom Ball

unread,
Feb 4, 2022, 1:19:26 PM2/4/22
to j2objc-...@googlegroups.com
Sounds good. BTW, why are you asking questions about J2CL on j2objc-discuss? That's why you got the generic answer from me. :-)

Dennis Liang

unread,
Feb 4, 2022, 1:26:16 PM2/4/22
to j2objc-...@googlegroups.com
Sorry my mistake, I meant J2objc. 

Tom Ball

unread,
Feb 4, 2022, 1:39:21 PM2/4/22
to j2objc-...@googlegroups.com
No worries, the answer is the same. :-)

Reply all
Reply to author
Forward
0 new messages