From 962ce2bc46f33f8dfae69b1fcaca42ef5f751ec9 Mon Sep 17 00:00:00 2001 From: Gary Peck Date: Wed, 9 Sep 2020 17:51:32 -0700 Subject: [PATCH] Update to recent Kotlin naming conventions - Rename "marshal"/"unmarshal" to "encode"/"decode" in all methods and classes - Standardize encoding/decoding methods to be named `encodeTo*` and `decodeFrom*`, similar to naming used in the standard libraries - Rename the low-level `marshal(MessageMarshaller)` and `unmarshal(MessageUnmarshaller)` methods to `encodeWith(MessageEncoder)` and `decodeWith(MessageDecoder)` Fixes #89 --- README.md | 21 +- .../kotlin/pbandk/conformance/Main.kt | 20 +- .../pbandk/conformance/pb/conformance.kt | 16 +- .../conformance/pb/test_messages_proto2.kt | 112 ++++---- .../conformance/pb/test_messages_proto3.kt | 88 +++--- .../kotlin/pbandk/examples/browserjs/Web.kt | 8 +- .../pbandk/examples/greeter/pb/helloworld.kt | 8 +- .../pbandk/examples/addressbook/Main.kt | 8 +- .../examples/addressbook/pb/addressbook.kt | 12 +- .../kotlin/pbandk/gen/CodeGenerator.kt | 24 +- .../src/commonMain/kotlin/pbandk/gen/Namer.kt | 7 +- .../commonMain/kotlin/pbandk/gen/pb/plugin.kt | 16 +- .../src/jvmMain/kotlin/pbandk/gen/Platform.kt | 10 +- runtime/api/runtime.api | 258 +++++++++--------- .../src/commonMain/kotlin/pbandk/Message.kt | 16 +- ...ssageUnmarshaller.kt => MessageDecoder.kt} | 2 +- ...MessageMarshaller.kt => MessageEncoder.kt} | 2 +- .../commonMain/kotlin/pbandk/MessageMap.kt | 2 +- ...nmarshaller.kt => BinaryMessageDecoder.kt} | 72 ++--- ...eMarshaller.kt => BinaryMessageEncoder.kt} | 26 +- ...reUnmarshaller.kt => BinaryWireDecoder.kt} | 4 +- ...WireMarshaller.kt => BinaryWireEncoder.kt} | 4 +- .../kotlin/KotlinBinaryMessageEncoder.kt | 14 + .../kotlin/KotlinBinaryMessageMarshaller.kt | 14 - ...rshaller.kt => KotlinBinaryWireDecoder.kt} | 12 +- ...rshaller.kt => KotlinBinaryWireEncoder.kt} | 4 +- ...eUnmarshaller.kt => JsonMessageDecoder.kt} | 15 +- ...ageMarshaller.kt => JsonMessageEncoder.kt} | 18 +- ...lueUnmarshaller.kt => JsonValueDecoder.kt} | 4 +- ...ValueMarshaller.kt => JsonValueEncoder.kt} | 8 +- .../kotlin/pbandk/json/MessageExtensions.kt | 14 +- .../src/commonMain/kotlin/pbandk/wkt/any.kt | 4 +- .../src/commonMain/kotlin/pbandk/wkt/api.kt | 12 +- .../kotlin/pbandk/wkt/descriptor.kt | 108 ++++---- .../commonMain/kotlin/pbandk/wkt/duration.kt | 4 +- .../src/commonMain/kotlin/pbandk/wkt/empty.kt | 4 +- .../kotlin/pbandk/wkt/field_mask.kt | 4 +- .../kotlin/pbandk/wkt/source_context.kt | 4 +- .../commonMain/kotlin/pbandk/wkt/struct.kt | 16 +- .../commonMain/kotlin/pbandk/wkt/timestamp.kt | 4 +- .../src/commonMain/kotlin/pbandk/wkt/type.kt | 20 +- .../commonMain/kotlin/pbandk/wkt/wrappers.kt | 36 +-- .../commonTest/kotlin/pbandk/RepeatedTest.kt | 4 +- .../commonTest/kotlin/pbandk/RoundTripTest.kt | 4 +- .../commonTest/kotlin/pbandk/json/JsonTest.kt | 34 +-- .../commonTest/kotlin/pbandk/testpb/test.kt | 20 +- .../pbandk/testpb/test_messages_proto3.kt | 88 +++--- .../internal/binary/BinaryMessageDecoderJs.kt | 10 + .../internal/binary/BinaryMessageEncoderJs.kt | 7 + .../binary/BinaryMessageMarshallerJs.kt | 7 - .../binary/BinaryMessageUnmarshallerJs.kt | 10 - .../ProtobufjsBinaryMessageEncoder.kt | 20 ++ .../ProtobufjsBinaryMessageMarshaller.kt | 20 -- ...ller.kt => ProtobufjsBinaryWireDecoder.kt} | 12 +- ...ller.kt => ProtobufjsBinaryWireEncoder.kt} | 4 +- .../kotlin/pbandk/MessageExtensionsJvm.kt | 12 +- .../binary/BinaryMessageDecoderJvm.kt | 18 ++ .../binary/BinaryMessageEncoderJvm.kt | 5 + .../binary/BinaryMessageMarshallerJvm.kt | 5 - .../binary/BinaryMessageUnmarshallerJvm.kt | 18 -- ...teArrayCodedStreamBinaryMessageEncoder.kt} | 8 +- ...ler.kt => CodedStreamBinaryWireDecoder.kt} | 8 +- ...ler.kt => CodedStreamBinaryWireEncoder.kt} | 2 +- runtime/src/jvmTest/kotlin/pbandk/MapTest.kt | 6 +- .../kotlin/pbandk/wkt/WellKnownTypesTest.kt | 6 +- .../binary/BinaryMessageDecoderNative.kt | 9 + .../binary/BinaryMessageEncoderNative.kt | 7 + .../binary/BinaryMessageMarshallerNative.kt | 7 - .../binary/BinaryMessageUnmarshallerNative.kt | 9 - 69 files changed, 711 insertions(+), 704 deletions(-) rename runtime/src/commonMain/kotlin/pbandk/{MessageUnmarshaller.kt => MessageDecoder.kt} (83%) rename runtime/src/commonMain/kotlin/pbandk/{MessageMarshaller.kt => MessageEncoder.kt} (68%) rename runtime/src/commonMain/kotlin/pbandk/internal/binary/{BinaryMessageUnmarshaller.kt => BinaryMessageDecoder.kt} (70%) rename runtime/src/commonMain/kotlin/pbandk/internal/binary/{BinaryMessageMarshaller.kt => BinaryMessageEncoder.kt} (77%) rename runtime/src/commonMain/kotlin/pbandk/internal/binary/{BinaryWireUnmarshaller.kt => BinaryWireDecoder.kt} (86%) rename runtime/src/commonMain/kotlin/pbandk/internal/binary/{BinaryWireMarshaller.kt => BinaryWireEncoder.kt} (96%) create mode 100644 runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryMessageEncoder.kt delete mode 100644 runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryMessageMarshaller.kt rename runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/{KotlinBinaryWireUnmarshaller.kt => KotlinBinaryWireDecoder.kt} (96%) rename runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/{KotlinBinaryWireMarshaller.kt => KotlinBinaryWireEncoder.kt} (98%) rename runtime/src/commonMain/kotlin/pbandk/internal/json/{JsonMessageUnmarshaller.kt => JsonMessageDecoder.kt} (84%) rename runtime/src/commonMain/kotlin/pbandk/internal/json/{JsonMessageMarshaller.kt => JsonMessageEncoder.kt} (74%) rename runtime/src/commonMain/kotlin/pbandk/internal/json/{JsonValueUnmarshaller.kt => JsonValueDecoder.kt} (98%) rename runtime/src/commonMain/kotlin/pbandk/internal/json/{JsonValueMarshaller.kt => JsonValueEncoder.kt} (94%) create mode 100644 runtime/src/jsMain/kotlin/pbandk/internal/binary/BinaryMessageDecoderJs.kt create mode 100644 runtime/src/jsMain/kotlin/pbandk/internal/binary/BinaryMessageEncoderJs.kt delete mode 100644 runtime/src/jsMain/kotlin/pbandk/internal/binary/BinaryMessageMarshallerJs.kt delete mode 100644 runtime/src/jsMain/kotlin/pbandk/internal/binary/BinaryMessageUnmarshallerJs.kt create mode 100644 runtime/src/jsMain/kotlin/pbandk/protobufjs/ProtobufjsBinaryMessageEncoder.kt delete mode 100644 runtime/src/jsMain/kotlin/pbandk/protobufjs/ProtobufjsBinaryMessageMarshaller.kt rename runtime/src/jsMain/kotlin/pbandk/protobufjs/{ProtobufjsBinaryWireUnmarshaller.kt => ProtobufjsBinaryWireDecoder.kt} (89%) rename runtime/src/jsMain/kotlin/pbandk/protobufjs/{ProtobufjsBinaryWireMarshaller.kt => ProtobufjsBinaryWireEncoder.kt} (97%) create mode 100644 runtime/src/jvmMain/kotlin/pbandk/internal/binary/BinaryMessageDecoderJvm.kt create mode 100644 runtime/src/jvmMain/kotlin/pbandk/internal/binary/BinaryMessageEncoderJvm.kt delete mode 100644 runtime/src/jvmMain/kotlin/pbandk/internal/binary/BinaryMessageMarshallerJvm.kt delete mode 100644 runtime/src/jvmMain/kotlin/pbandk/internal/binary/BinaryMessageUnmarshallerJvm.kt rename runtime/src/jvmMain/kotlin/pbandk/internal/binary/{ByteArrayCodedStreamBinaryMessageMarshaller.kt => ByteArrayCodedStreamBinaryMessageEncoder.kt} (50%) rename runtime/src/jvmMain/kotlin/pbandk/internal/binary/{CodedStreamBinaryWireUnmarshaller.kt => CodedStreamBinaryWireDecoder.kt} (91%) rename runtime/src/jvmMain/kotlin/pbandk/internal/binary/{CodedStreamBinaryWireMarshaller.kt => CodedStreamBinaryWireEncoder.kt} (97%) create mode 100644 runtime/src/nativeMain/kotlin/pbandk/internal/binary/BinaryMessageDecoderNative.kt create mode 100644 runtime/src/nativeMain/kotlin/pbandk/internal/binary/BinaryMessageEncoderNative.kt delete mode 100644 runtime/src/nativeMain/kotlin/pbandk/internal/binary/BinaryMessageMarshallerNative.kt delete mode 100644 runtime/src/nativeMain/kotlin/pbandk/internal/binary/BinaryMessageUnmarshallerNative.kt diff --git a/README.md b/README.md index ea088ca6..ccf9b576 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ data class Person( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { Person() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = Person.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = Person.decodeWithImpl(u) override val descriptors: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -181,7 +181,7 @@ data class Person( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { Person.PhoneNumber() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = Person.PhoneNumber.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = Person.PhoneNumber.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -220,7 +220,7 @@ data class AddressBook( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { AddressBook() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = AddressBook.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = AddressBook.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -374,15 +374,16 @@ package is referenced, it is assumed to be a well-known type and is changed to r ### Message -Each Protobuf message extends `pbandk.Message` and has two overloaded `protoMarshal` methods, the most useful of which -marshals to a byte array. The companion object of every message has two overloaded `protoUnmarshal` methods, the most -useful of which accepts a byte array and returns an instance of the class. The other `protoMarshal` and `protoUnmarshal` -methods accept `Marshaller` and `Unmarshaller` instances respectively which are different for each platform. For -example, the JVM `Marshaller` uses `com.google.protobuf.CodedOutputStream`. +Each Protobuf message extends `pbandk.Message` and has an `encodeToByteArray` method to encode the message with the +Protobuf binary encoding into a byte array. The companion object of every message has a `decodeFromByteArray` method: it +accepts a byte array and returns an instance of the class. Each platform also provides additional `encodeTo*` and +`decodeFrom*` methods that are platform-specific. For example, the JVM provides `encodeToStream` and `decodeFromStream` +methods that operate on Java's `OutputStream` and `InputStream`, respectively, and use +`com.google.protobuf.CodedOutputStream` internally. Messages are immutable Kotlin data classes. This means they automatically implement `hashCode`, `equals`, and -`toString`. Each class has an `unknownFields` map which contains information about extra fields the unmarshaller didn't -recognize. If there are values in this map, they will be marshalled on output. The `Unmarshaller` instances have a +`toString`. Each class has an `unknownFields` map which contains information about extra fields the decoder didn't +recognize. If there are values in this map, they will be encoded on output. The `MessageDecoder` instances have a constructor option to discard unknown fields when reading. For proto3, the only nullable fields are other messages and oneof fields. Other values have defaults. For proto2, diff --git a/conformance/lib/src/commonMain/kotlin/pbandk/conformance/Main.kt b/conformance/lib/src/commonMain/kotlin/pbandk/conformance/Main.kt index a2dbdf85..ff12aa20 100644 --- a/conformance/lib/src/commonMain/kotlin/pbandk/conformance/Main.kt +++ b/conformance/lib/src/commonMain/kotlin/pbandk/conformance/Main.kt @@ -5,10 +5,10 @@ import pbandk.ExperimentalProtoJson import pbandk.conformance.Platform.runBlockingMain import pbandk.conformance.pb.* import pbandk.json.JsonConfig -import pbandk.json.jsonMarshal -import pbandk.json.jsonUnmarshal -import pbandk.protoMarshal -import pbandk.protoUnmarshal +import pbandk.json.encodeToJsonString +import pbandk.json.decodeFromJsonString +import pbandk.encodeToByteArray +import pbandk.decodeFromByteArray var logDebug = false @@ -21,7 +21,7 @@ fun main(args: Array) = runBlockingMain { while (true) { val res = doTestIo().also { debug { "Result: $it" } } ?: return@runBlockingMain - ConformanceResponse(res).protoMarshal().also { bytes -> + ConformanceResponse(res).encodeToByteArray().also { bytes -> Platform.stdoutWriteIntLE(bytes.size) Platform.stdoutWriteFull(bytes) } @@ -33,7 +33,7 @@ suspend fun doTestIo(): ConformanceResponse.Result<*>? { // Read the request (starting with by size) val req = Platform.doTry({ val size = Platform.stdinReadIntLE()?.also { debug { "Reading $it bytes" } } ?: return null - ConformanceRequest.protoUnmarshal(Platform.stdinReadFull(size)).also { debug { "Request: $it" } } + ConformanceRequest.decodeFromByteArray(Platform.stdinReadFull(size)).also { debug { "Request: $it" } } }) { err -> return ConformanceResponse.Result.RuntimeError("Failed reading request: $err") } // Parse val parsed = Platform.doTry({ @@ -45,7 +45,7 @@ suspend fun doTestIo(): ConformanceResponse.Result<*>? { when (req.payload) { is ConformanceRequest.Payload.ProtobufPayload -> { - typeComp.protoUnmarshal(req.payload.value.array).also { debug { "Parsed: $it" } } + typeComp.decodeFromByteArray(req.payload.value.array).also { debug { "Parsed: $it" } } } is ConformanceRequest.Payload.JsonPayload -> { val jsonConfig = when (req.testCategory) { @@ -54,7 +54,7 @@ suspend fun doTestIo(): ConformanceResponse.Result<*>? { ) else -> JsonConfig.DEFAULT } - typeComp.jsonUnmarshal(req.payload.value, jsonConfig).also { debug { "Parsed: $it" } } + typeComp.decodeFromJsonString(req.payload.value, jsonConfig).also { debug { "Parsed: $it" } } } else -> { return ConformanceResponse.Result.Skipped("Only protobuf and json input supported") @@ -67,8 +67,8 @@ suspend fun doTestIo(): ConformanceResponse.Result<*>? { // Serialize return Platform.doTry({ when (req.requestedOutputFormat) { - is WireFormat.PROTOBUF -> ConformanceResponse.Result.ProtobufPayload(ByteArr(parsed.protoMarshal())) - is WireFormat.JSON -> ConformanceResponse.Result.JsonPayload(parsed.jsonMarshal()) + is WireFormat.PROTOBUF -> ConformanceResponse.Result.ProtobufPayload(ByteArr(parsed.encodeToByteArray())) + is WireFormat.JSON -> ConformanceResponse.Result.JsonPayload(parsed.encodeToJsonString()) else -> { return ConformanceResponse.Result.Skipped("Only protobuf and json output supported") } diff --git a/conformance/lib/src/commonMain/kotlin/pbandk/conformance/pb/conformance.kt b/conformance/lib/src/commonMain/kotlin/pbandk/conformance/pb/conformance.kt index 6c568cba..0a3c87d0 100644 --- a/conformance/lib/src/commonMain/kotlin/pbandk/conformance/pb/conformance.kt +++ b/conformance/lib/src/commonMain/kotlin/pbandk/conformance/pb/conformance.kt @@ -50,7 +50,7 @@ data class FailureSet( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { FailureSet() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = FailureSet.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = FailureSet.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -101,7 +101,7 @@ data class ConformanceRequest( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { ConformanceRequest() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = ConformanceRequest.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = ConformanceRequest.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -227,7 +227,7 @@ data class ConformanceResponse( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { ConformanceResponse() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = ConformanceResponse.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = ConformanceResponse.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -321,7 +321,7 @@ data class JspbEncodingConfig( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { JspbEncodingConfig() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = JspbEncodingConfig.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = JspbEncodingConfig.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -350,7 +350,7 @@ private fun FailureSet.protoMergeImpl(plus: pbandk.Message?): FailureSet = (plus ) ?: this @Suppress("UNCHECKED_CAST") -private fun FailureSet.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): FailureSet { +private fun FailureSet.Companion.decodeWithImpl(u: pbandk.MessageDecoder): FailureSet { var failure: pbandk.ListWithSize.Builder? = null val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> @@ -370,7 +370,7 @@ private fun ConformanceRequest.protoMergeImpl(plus: pbandk.Message?): Conformanc ) ?: this @Suppress("UNCHECKED_CAST") -private fun ConformanceRequest.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): ConformanceRequest { +private fun ConformanceRequest.Companion.decodeWithImpl(u: pbandk.MessageDecoder): ConformanceRequest { var requestedOutputFormat: pbandk.conformance.pb.WireFormat = pbandk.conformance.pb.WireFormat.fromValue(0) var messageType = "" var testCategory: pbandk.conformance.pb.TestCategory = pbandk.conformance.pb.TestCategory.fromValue(0) @@ -403,7 +403,7 @@ private fun ConformanceResponse.protoMergeImpl(plus: pbandk.Message?): Conforman ) ?: this @Suppress("UNCHECKED_CAST") -private fun ConformanceResponse.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): ConformanceResponse { +private fun ConformanceResponse.Companion.decodeWithImpl(u: pbandk.MessageDecoder): ConformanceResponse { var result: ConformanceResponse.Result<*>? = null val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> @@ -428,7 +428,7 @@ private fun JspbEncodingConfig.protoMergeImpl(plus: pbandk.Message?): JspbEncodi ) ?: this @Suppress("UNCHECKED_CAST") -private fun JspbEncodingConfig.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): JspbEncodingConfig { +private fun JspbEncodingConfig.Companion.decodeWithImpl(u: pbandk.MessageDecoder): JspbEncodingConfig { var useJspbArrayAnyFormat = false val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> diff --git a/conformance/lib/src/commonMain/kotlin/pbandk/conformance/pb/test_messages_proto2.kt b/conformance/lib/src/commonMain/kotlin/pbandk/conformance/pb/test_messages_proto2.kt index 391e5d16..47da3140 100644 --- a/conformance/lib/src/commonMain/kotlin/pbandk/conformance/pb/test_messages_proto2.kt +++ b/conformance/lib/src/commonMain/kotlin/pbandk/conformance/pb/test_messages_proto2.kt @@ -167,7 +167,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1152,7 +1152,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.NestedMessage() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.NestedMessage.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.NestedMessage.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1191,7 +1191,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapInt32Int32Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapInt32Int32Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapInt32Int32Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1230,7 +1230,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapInt64Int64Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapInt64Int64Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapInt64Int64Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1269,7 +1269,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapUint32Uint32Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapUint32Uint32Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapUint32Uint32Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1308,7 +1308,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapUint64Uint64Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapUint64Uint64Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapUint64Uint64Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1347,7 +1347,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapSint32Sint32Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapSint32Sint32Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapSint32Sint32Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1386,7 +1386,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapSint64Sint64Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapSint64Sint64Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapSint64Sint64Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1425,7 +1425,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapFixed32Fixed32Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapFixed32Fixed32Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapFixed32Fixed32Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1464,7 +1464,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapFixed64Fixed64Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapFixed64Fixed64Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapFixed64Fixed64Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1503,7 +1503,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapSfixed32Sfixed32Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapSfixed32Sfixed32Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapSfixed32Sfixed32Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1542,7 +1542,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapSfixed64Sfixed64Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapSfixed64Sfixed64Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapSfixed64Sfixed64Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1581,7 +1581,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapInt32FloatEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapInt32FloatEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapInt32FloatEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1620,7 +1620,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapInt32DoubleEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapInt32DoubleEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapInt32DoubleEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1659,7 +1659,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapBoolBoolEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapBoolBoolEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapBoolBoolEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1698,7 +1698,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapStringStringEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapStringStringEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapStringStringEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1737,7 +1737,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapStringBytesEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapStringBytesEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapStringBytesEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1776,7 +1776,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapStringNestedMessageEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapStringNestedMessageEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapStringNestedMessageEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1815,7 +1815,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapStringForeignMessageEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapStringForeignMessageEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapStringForeignMessageEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1854,7 +1854,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapStringNestedEnumEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapStringNestedEnumEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapStringNestedEnumEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1893,7 +1893,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MapStringForeignEnumEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MapStringForeignEnumEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MapStringForeignEnumEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1932,7 +1932,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.Data() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.Data.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.Data.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1969,7 +1969,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MessageSetCorrect() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MessageSetCorrect.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MessageSetCorrect.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1991,7 +1991,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MessageSetCorrectExtension1() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MessageSetCorrectExtension1.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MessageSetCorrectExtension1.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -2021,7 +2021,7 @@ data class TestAllTypesProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto2.MessageSetCorrectExtension2() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto2.MessageSetCorrectExtension2.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto2.MessageSetCorrectExtension2.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -2052,7 +2052,7 @@ data class ForeignMessageProto2( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { ForeignMessageProto2() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = ForeignMessageProto2.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = ForeignMessageProto2.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -2086,7 +2086,7 @@ data class UnknownToTestAllTypes( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { UnknownToTestAllTypes() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = UnknownToTestAllTypes.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = UnknownToTestAllTypes.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -2147,7 +2147,7 @@ data class UnknownToTestAllTypes( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { UnknownToTestAllTypes.OptionalGroup() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = UnknownToTestAllTypes.OptionalGroup.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = UnknownToTestAllTypes.OptionalGroup.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -2290,7 +2290,7 @@ private fun TestAllTypesProto2.protoMergeImpl(plus: pbandk.Message?): TestAllTyp ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2 { +private fun TestAllTypesProto2.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2 { var optionalInt32: Int? = null var optionalInt64: Long? = null var optionalUint32: Int? = null @@ -2561,7 +2561,7 @@ private fun TestAllTypesProto2.NestedMessage.protoMergeImpl(plus: pbandk.Message ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.NestedMessage.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.NestedMessage { +private fun TestAllTypesProto2.NestedMessage.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.NestedMessage { var a: Int? = null var corecursive: pbandk.conformance.pb.TestAllTypesProto2? = null @@ -2583,7 +2583,7 @@ private fun TestAllTypesProto2.MapInt32Int32Entry.protoMergeImpl(plus: pbandk.Me ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapInt32Int32Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapInt32Int32Entry { +private fun TestAllTypesProto2.MapInt32Int32Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapInt32Int32Entry { var key: Int? = null var value: Int? = null @@ -2605,7 +2605,7 @@ private fun TestAllTypesProto2.MapInt64Int64Entry.protoMergeImpl(plus: pbandk.Me ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapInt64Int64Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapInt64Int64Entry { +private fun TestAllTypesProto2.MapInt64Int64Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapInt64Int64Entry { var key: Long? = null var value: Long? = null @@ -2627,7 +2627,7 @@ private fun TestAllTypesProto2.MapUint32Uint32Entry.protoMergeImpl(plus: pbandk. ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapUint32Uint32Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapUint32Uint32Entry { +private fun TestAllTypesProto2.MapUint32Uint32Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapUint32Uint32Entry { var key: Int? = null var value: Int? = null @@ -2649,7 +2649,7 @@ private fun TestAllTypesProto2.MapUint64Uint64Entry.protoMergeImpl(plus: pbandk. ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapUint64Uint64Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapUint64Uint64Entry { +private fun TestAllTypesProto2.MapUint64Uint64Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapUint64Uint64Entry { var key: Long? = null var value: Long? = null @@ -2671,7 +2671,7 @@ private fun TestAllTypesProto2.MapSint32Sint32Entry.protoMergeImpl(plus: pbandk. ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapSint32Sint32Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapSint32Sint32Entry { +private fun TestAllTypesProto2.MapSint32Sint32Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapSint32Sint32Entry { var key: Int? = null var value: Int? = null @@ -2693,7 +2693,7 @@ private fun TestAllTypesProto2.MapSint64Sint64Entry.protoMergeImpl(plus: pbandk. ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapSint64Sint64Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapSint64Sint64Entry { +private fun TestAllTypesProto2.MapSint64Sint64Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapSint64Sint64Entry { var key: Long? = null var value: Long? = null @@ -2715,7 +2715,7 @@ private fun TestAllTypesProto2.MapFixed32Fixed32Entry.protoMergeImpl(plus: pband ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapFixed32Fixed32Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapFixed32Fixed32Entry { +private fun TestAllTypesProto2.MapFixed32Fixed32Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapFixed32Fixed32Entry { var key: Int? = null var value: Int? = null @@ -2737,7 +2737,7 @@ private fun TestAllTypesProto2.MapFixed64Fixed64Entry.protoMergeImpl(plus: pband ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapFixed64Fixed64Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapFixed64Fixed64Entry { +private fun TestAllTypesProto2.MapFixed64Fixed64Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapFixed64Fixed64Entry { var key: Long? = null var value: Long? = null @@ -2759,7 +2759,7 @@ private fun TestAllTypesProto2.MapSfixed32Sfixed32Entry.protoMergeImpl(plus: pba ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapSfixed32Sfixed32Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapSfixed32Sfixed32Entry { +private fun TestAllTypesProto2.MapSfixed32Sfixed32Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapSfixed32Sfixed32Entry { var key: Int? = null var value: Int? = null @@ -2781,7 +2781,7 @@ private fun TestAllTypesProto2.MapSfixed64Sfixed64Entry.protoMergeImpl(plus: pba ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapSfixed64Sfixed64Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapSfixed64Sfixed64Entry { +private fun TestAllTypesProto2.MapSfixed64Sfixed64Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapSfixed64Sfixed64Entry { var key: Long? = null var value: Long? = null @@ -2803,7 +2803,7 @@ private fun TestAllTypesProto2.MapInt32FloatEntry.protoMergeImpl(plus: pbandk.Me ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapInt32FloatEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapInt32FloatEntry { +private fun TestAllTypesProto2.MapInt32FloatEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapInt32FloatEntry { var key: Int? = null var value: Float? = null @@ -2825,7 +2825,7 @@ private fun TestAllTypesProto2.MapInt32DoubleEntry.protoMergeImpl(plus: pbandk.M ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapInt32DoubleEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapInt32DoubleEntry { +private fun TestAllTypesProto2.MapInt32DoubleEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapInt32DoubleEntry { var key: Int? = null var value: Double? = null @@ -2847,7 +2847,7 @@ private fun TestAllTypesProto2.MapBoolBoolEntry.protoMergeImpl(plus: pbandk.Mess ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapBoolBoolEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapBoolBoolEntry { +private fun TestAllTypesProto2.MapBoolBoolEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapBoolBoolEntry { var key: Boolean? = null var value: Boolean? = null @@ -2869,7 +2869,7 @@ private fun TestAllTypesProto2.MapStringStringEntry.protoMergeImpl(plus: pbandk. ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapStringStringEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapStringStringEntry { +private fun TestAllTypesProto2.MapStringStringEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapStringStringEntry { var key: String? = null var value: String? = null @@ -2891,7 +2891,7 @@ private fun TestAllTypesProto2.MapStringBytesEntry.protoMergeImpl(plus: pbandk.M ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapStringBytesEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapStringBytesEntry { +private fun TestAllTypesProto2.MapStringBytesEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapStringBytesEntry { var key: String? = null var value: pbandk.ByteArr? = null @@ -2913,7 +2913,7 @@ private fun TestAllTypesProto2.MapStringNestedMessageEntry.protoMergeImpl(plus: ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapStringNestedMessageEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapStringNestedMessageEntry { +private fun TestAllTypesProto2.MapStringNestedMessageEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapStringNestedMessageEntry { var key: String? = null var value: pbandk.conformance.pb.TestAllTypesProto2.NestedMessage? = null @@ -2935,7 +2935,7 @@ private fun TestAllTypesProto2.MapStringForeignMessageEntry.protoMergeImpl(plus: ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapStringForeignMessageEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapStringForeignMessageEntry { +private fun TestAllTypesProto2.MapStringForeignMessageEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapStringForeignMessageEntry { var key: String? = null var value: pbandk.conformance.pb.ForeignMessageProto2? = null @@ -2957,7 +2957,7 @@ private fun TestAllTypesProto2.MapStringNestedEnumEntry.protoMergeImpl(plus: pba ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapStringNestedEnumEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapStringNestedEnumEntry { +private fun TestAllTypesProto2.MapStringNestedEnumEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapStringNestedEnumEntry { var key: String? = null var value: pbandk.conformance.pb.TestAllTypesProto2.NestedEnum? = null @@ -2979,7 +2979,7 @@ private fun TestAllTypesProto2.MapStringForeignEnumEntry.protoMergeImpl(plus: pb ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MapStringForeignEnumEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MapStringForeignEnumEntry { +private fun TestAllTypesProto2.MapStringForeignEnumEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MapStringForeignEnumEntry { var key: String? = null var value: pbandk.conformance.pb.ForeignEnumProto2? = null @@ -3001,7 +3001,7 @@ private fun TestAllTypesProto2.Data.protoMergeImpl(plus: pbandk.Message?): TestA ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.Data.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.Data { +private fun TestAllTypesProto2.Data.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.Data { var groupInt32: Int? = null var groupUint32: Int? = null @@ -3021,7 +3021,7 @@ private fun TestAllTypesProto2.MessageSetCorrect.protoMergeImpl(plus: pbandk.Mes ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MessageSetCorrect.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MessageSetCorrect { +private fun TestAllTypesProto2.MessageSetCorrect.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MessageSetCorrect { val unknownFields = u.readMessage(this) { _, _ -> } return TestAllTypesProto2.MessageSetCorrect(unknownFields) @@ -3035,7 +3035,7 @@ private fun TestAllTypesProto2.MessageSetCorrectExtension1.protoMergeImpl(plus: ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MessageSetCorrectExtension1.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MessageSetCorrectExtension1 { +private fun TestAllTypesProto2.MessageSetCorrectExtension1.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MessageSetCorrectExtension1 { var str: String? = null val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> @@ -3054,7 +3054,7 @@ private fun TestAllTypesProto2.MessageSetCorrectExtension2.protoMergeImpl(plus: ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto2.MessageSetCorrectExtension2.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto2.MessageSetCorrectExtension2 { +private fun TestAllTypesProto2.MessageSetCorrectExtension2.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto2.MessageSetCorrectExtension2 { var i: Int? = null val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> @@ -3073,7 +3073,7 @@ private fun ForeignMessageProto2.protoMergeImpl(plus: pbandk.Message?): ForeignM ) ?: this @Suppress("UNCHECKED_CAST") -private fun ForeignMessageProto2.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): ForeignMessageProto2 { +private fun ForeignMessageProto2.Companion.decodeWithImpl(u: pbandk.MessageDecoder): ForeignMessageProto2 { var c: Int? = null val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> @@ -3096,7 +3096,7 @@ private fun UnknownToTestAllTypes.protoMergeImpl(plus: pbandk.Message?): Unknown ) ?: this @Suppress("UNCHECKED_CAST") -private fun UnknownToTestAllTypes.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): UnknownToTestAllTypes { +private fun UnknownToTestAllTypes.Companion.decodeWithImpl(u: pbandk.MessageDecoder): UnknownToTestAllTypes { var optionalInt32: Int? = null var optionalString: String? = null var nestedMessage: pbandk.conformance.pb.ForeignMessageProto2? = null @@ -3124,7 +3124,7 @@ private fun UnknownToTestAllTypes.OptionalGroup.protoMergeImpl(plus: pbandk.Mess ) ?: this @Suppress("UNCHECKED_CAST") -private fun UnknownToTestAllTypes.OptionalGroup.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): UnknownToTestAllTypes.OptionalGroup { +private fun UnknownToTestAllTypes.OptionalGroup.Companion.decodeWithImpl(u: pbandk.MessageDecoder): UnknownToTestAllTypes.OptionalGroup { var a: Int? = null val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> diff --git a/conformance/lib/src/commonMain/kotlin/pbandk/conformance/pb/test_messages_proto3.kt b/conformance/lib/src/commonMain/kotlin/pbandk/conformance/pb/test_messages_proto3.kt index 0029373a..75095051 100644 --- a/conformance/lib/src/commonMain/kotlin/pbandk/conformance/pb/test_messages_proto3.kt +++ b/conformance/lib/src/commonMain/kotlin/pbandk/conformance/pb/test_messages_proto3.kt @@ -199,7 +199,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1460,7 +1460,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.NestedMessage() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.NestedMessage.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.NestedMessage.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1499,7 +1499,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapInt32Int32Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapInt32Int32Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapInt32Int32Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1538,7 +1538,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapInt64Int64Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapInt64Int64Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapInt64Int64Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1577,7 +1577,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapUint32Uint32Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapUint32Uint32Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapUint32Uint32Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1616,7 +1616,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapUint64Uint64Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapUint64Uint64Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapUint64Uint64Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1655,7 +1655,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapSint32Sint32Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapSint32Sint32Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapSint32Sint32Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1694,7 +1694,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapSint64Sint64Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapSint64Sint64Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapSint64Sint64Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1733,7 +1733,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapFixed32Fixed32Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapFixed32Fixed32Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapFixed32Fixed32Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1772,7 +1772,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapFixed64Fixed64Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapFixed64Fixed64Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapFixed64Fixed64Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1811,7 +1811,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapSfixed32Sfixed32Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapSfixed32Sfixed32Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapSfixed32Sfixed32Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1850,7 +1850,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapSfixed64Sfixed64Entry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapSfixed64Sfixed64Entry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapSfixed64Sfixed64Entry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1889,7 +1889,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapInt32FloatEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapInt32FloatEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapInt32FloatEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1928,7 +1928,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapInt32DoubleEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapInt32DoubleEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapInt32DoubleEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1967,7 +1967,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapBoolBoolEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapBoolBoolEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapBoolBoolEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -2006,7 +2006,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapStringStringEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapStringStringEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapStringStringEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -2045,7 +2045,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapStringBytesEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapStringBytesEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapStringBytesEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -2084,7 +2084,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapStringNestedMessageEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapStringNestedMessageEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapStringNestedMessageEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -2123,7 +2123,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapStringForeignMessageEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapStringForeignMessageEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapStringForeignMessageEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -2162,7 +2162,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapStringNestedEnumEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapStringNestedEnumEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapStringNestedEnumEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -2201,7 +2201,7 @@ data class TestAllTypesProto3( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { TestAllTypesProto3.MapStringForeignEnumEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = TestAllTypesProto3.MapStringForeignEnumEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = TestAllTypesProto3.MapStringForeignEnumEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -2240,7 +2240,7 @@ data class ForeignMessage( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { ForeignMessage() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = ForeignMessage.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = ForeignMessage.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -2376,7 +2376,7 @@ private fun TestAllTypesProto3.protoMergeImpl(plus: pbandk.Message?): TestAllTyp ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3 { +private fun TestAllTypesProto3.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3 { var optionalInt32 = 0 var optionalInt64 = 0L var optionalUint32 = 0 @@ -2718,7 +2718,7 @@ private fun TestAllTypesProto3.NestedMessage.protoMergeImpl(plus: pbandk.Message ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.NestedMessage.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.NestedMessage { +private fun TestAllTypesProto3.NestedMessage.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.NestedMessage { var a = 0 var corecursive: pbandk.conformance.pb.TestAllTypesProto3? = null @@ -2738,7 +2738,7 @@ private fun TestAllTypesProto3.MapInt32Int32Entry.protoMergeImpl(plus: pbandk.Me ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapInt32Int32Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapInt32Int32Entry { +private fun TestAllTypesProto3.MapInt32Int32Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapInt32Int32Entry { var key = 0 var value = 0 @@ -2758,7 +2758,7 @@ private fun TestAllTypesProto3.MapInt64Int64Entry.protoMergeImpl(plus: pbandk.Me ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapInt64Int64Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapInt64Int64Entry { +private fun TestAllTypesProto3.MapInt64Int64Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapInt64Int64Entry { var key = 0L var value = 0L @@ -2778,7 +2778,7 @@ private fun TestAllTypesProto3.MapUint32Uint32Entry.protoMergeImpl(plus: pbandk. ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapUint32Uint32Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapUint32Uint32Entry { +private fun TestAllTypesProto3.MapUint32Uint32Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapUint32Uint32Entry { var key = 0 var value = 0 @@ -2798,7 +2798,7 @@ private fun TestAllTypesProto3.MapUint64Uint64Entry.protoMergeImpl(plus: pbandk. ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapUint64Uint64Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapUint64Uint64Entry { +private fun TestAllTypesProto3.MapUint64Uint64Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapUint64Uint64Entry { var key = 0L var value = 0L @@ -2818,7 +2818,7 @@ private fun TestAllTypesProto3.MapSint32Sint32Entry.protoMergeImpl(plus: pbandk. ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapSint32Sint32Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapSint32Sint32Entry { +private fun TestAllTypesProto3.MapSint32Sint32Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapSint32Sint32Entry { var key = 0 var value = 0 @@ -2838,7 +2838,7 @@ private fun TestAllTypesProto3.MapSint64Sint64Entry.protoMergeImpl(plus: pbandk. ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapSint64Sint64Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapSint64Sint64Entry { +private fun TestAllTypesProto3.MapSint64Sint64Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapSint64Sint64Entry { var key = 0L var value = 0L @@ -2858,7 +2858,7 @@ private fun TestAllTypesProto3.MapFixed32Fixed32Entry.protoMergeImpl(plus: pband ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapFixed32Fixed32Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapFixed32Fixed32Entry { +private fun TestAllTypesProto3.MapFixed32Fixed32Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapFixed32Fixed32Entry { var key = 0 var value = 0 @@ -2878,7 +2878,7 @@ private fun TestAllTypesProto3.MapFixed64Fixed64Entry.protoMergeImpl(plus: pband ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapFixed64Fixed64Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapFixed64Fixed64Entry { +private fun TestAllTypesProto3.MapFixed64Fixed64Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapFixed64Fixed64Entry { var key = 0L var value = 0L @@ -2898,7 +2898,7 @@ private fun TestAllTypesProto3.MapSfixed32Sfixed32Entry.protoMergeImpl(plus: pba ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapSfixed32Sfixed32Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapSfixed32Sfixed32Entry { +private fun TestAllTypesProto3.MapSfixed32Sfixed32Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapSfixed32Sfixed32Entry { var key = 0 var value = 0 @@ -2918,7 +2918,7 @@ private fun TestAllTypesProto3.MapSfixed64Sfixed64Entry.protoMergeImpl(plus: pba ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapSfixed64Sfixed64Entry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapSfixed64Sfixed64Entry { +private fun TestAllTypesProto3.MapSfixed64Sfixed64Entry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapSfixed64Sfixed64Entry { var key = 0L var value = 0L @@ -2938,7 +2938,7 @@ private fun TestAllTypesProto3.MapInt32FloatEntry.protoMergeImpl(plus: pbandk.Me ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapInt32FloatEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapInt32FloatEntry { +private fun TestAllTypesProto3.MapInt32FloatEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapInt32FloatEntry { var key = 0 var value = 0.0F @@ -2958,7 +2958,7 @@ private fun TestAllTypesProto3.MapInt32DoubleEntry.protoMergeImpl(plus: pbandk.M ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapInt32DoubleEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapInt32DoubleEntry { +private fun TestAllTypesProto3.MapInt32DoubleEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapInt32DoubleEntry { var key = 0 var value = 0.0 @@ -2978,7 +2978,7 @@ private fun TestAllTypesProto3.MapBoolBoolEntry.protoMergeImpl(plus: pbandk.Mess ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapBoolBoolEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapBoolBoolEntry { +private fun TestAllTypesProto3.MapBoolBoolEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapBoolBoolEntry { var key = false var value = false @@ -2998,7 +2998,7 @@ private fun TestAllTypesProto3.MapStringStringEntry.protoMergeImpl(plus: pbandk. ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapStringStringEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapStringStringEntry { +private fun TestAllTypesProto3.MapStringStringEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapStringStringEntry { var key = "" var value = "" @@ -3018,7 +3018,7 @@ private fun TestAllTypesProto3.MapStringBytesEntry.protoMergeImpl(plus: pbandk.M ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapStringBytesEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapStringBytesEntry { +private fun TestAllTypesProto3.MapStringBytesEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapStringBytesEntry { var key = "" var value: pbandk.ByteArr = pbandk.ByteArr.empty @@ -3039,7 +3039,7 @@ private fun TestAllTypesProto3.MapStringNestedMessageEntry.protoMergeImpl(plus: ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapStringNestedMessageEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapStringNestedMessageEntry { +private fun TestAllTypesProto3.MapStringNestedMessageEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapStringNestedMessageEntry { var key = "" var value: pbandk.conformance.pb.TestAllTypesProto3.NestedMessage? = null @@ -3060,7 +3060,7 @@ private fun TestAllTypesProto3.MapStringForeignMessageEntry.protoMergeImpl(plus: ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapStringForeignMessageEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapStringForeignMessageEntry { +private fun TestAllTypesProto3.MapStringForeignMessageEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapStringForeignMessageEntry { var key = "" var value: pbandk.conformance.pb.ForeignMessage? = null @@ -3080,7 +3080,7 @@ private fun TestAllTypesProto3.MapStringNestedEnumEntry.protoMergeImpl(plus: pba ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapStringNestedEnumEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapStringNestedEnumEntry { +private fun TestAllTypesProto3.MapStringNestedEnumEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapStringNestedEnumEntry { var key = "" var value: pbandk.conformance.pb.TestAllTypesProto3.NestedEnum = pbandk.conformance.pb.TestAllTypesProto3.NestedEnum.fromValue(0) @@ -3100,7 +3100,7 @@ private fun TestAllTypesProto3.MapStringForeignEnumEntry.protoMergeImpl(plus: pb ) ?: this @Suppress("UNCHECKED_CAST") -private fun TestAllTypesProto3.MapStringForeignEnumEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): TestAllTypesProto3.MapStringForeignEnumEntry { +private fun TestAllTypesProto3.MapStringForeignEnumEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): TestAllTypesProto3.MapStringForeignEnumEntry { var key = "" var value: pbandk.conformance.pb.ForeignEnum = pbandk.conformance.pb.ForeignEnum.fromValue(0) @@ -3120,7 +3120,7 @@ private fun ForeignMessage.protoMergeImpl(plus: pbandk.Message?): ForeignMessage ) ?: this @Suppress("UNCHECKED_CAST") -private fun ForeignMessage.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): ForeignMessage { +private fun ForeignMessage.Companion.decodeWithImpl(u: pbandk.MessageDecoder): ForeignMessage { var c = 0 val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> diff --git a/examples/browser-js/app/src/main/kotlin/pbandk/examples/browserjs/Web.kt b/examples/browser-js/app/src/main/kotlin/pbandk/examples/browserjs/Web.kt index eed5bfbd..c3a168c0 100644 --- a/examples/browser-js/app/src/main/kotlin/pbandk/examples/browserjs/Web.kt +++ b/examples/browser-js/app/src/main/kotlin/pbandk/examples/browserjs/Web.kt @@ -1,10 +1,10 @@ package pbandk.examples.browserjs import org.w3c.dom.* +import pbandk.decodeFromByteArray +import pbandk.encodeToByteArray import pbandk.examples.browserjs.pb.AddressBook import pbandk.examples.browserjs.pb.Person -import pbandk.protoMarshal -import pbandk.protoUnmarshal import kotlin.browser.document import kotlin.browser.localStorage import kotlin.browser.window @@ -21,10 +21,10 @@ fun main(args: Array) { // I'm just being lazy/inefficient because I don't want to mess with IndexedDB fun loadBook() = localStorage["addressBook"]?.let { str -> - AddressBook.protoUnmarshal(JSON.parse>(str).toByteArray()) + AddressBook.decodeFromByteArray(JSON.parse>(str).toByteArray()) } ?: AddressBook() fun saveBook(book: AddressBook) { - localStorage["addressBook"] = JSON.stringify(book.protoMarshal().toTypedArray()) + localStorage["addressBook"] = JSON.stringify(book.encodeToByteArray().toTypedArray()) } fun createTable() = createElem("table").apply { diff --git a/examples/custom-service-gen/application/src/main/kotlin/pbandk/examples/greeter/pb/helloworld.kt b/examples/custom-service-gen/application/src/main/kotlin/pbandk/examples/greeter/pb/helloworld.kt index 715b13a7..509d8cdf 100644 --- a/examples/custom-service-gen/application/src/main/kotlin/pbandk/examples/greeter/pb/helloworld.kt +++ b/examples/custom-service-gen/application/src/main/kotlin/pbandk/examples/greeter/pb/helloworld.kt @@ -11,7 +11,7 @@ data class HelloRequest( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { HelloRequest() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = HelloRequest.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = HelloRequest.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -41,7 +41,7 @@ data class HelloReply( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { HelloReply() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = HelloReply.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = HelloReply.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -69,7 +69,7 @@ private fun HelloRequest.protoMergeImpl(plus: pbandk.Message?): HelloRequest = ( ) ?: this @Suppress("UNCHECKED_CAST") -private fun HelloRequest.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): HelloRequest { +private fun HelloRequest.Companion.decodeWithImpl(u: pbandk.MessageDecoder): HelloRequest { var name = "" val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> @@ -87,7 +87,7 @@ private fun HelloReply.protoMergeImpl(plus: pbandk.Message?): HelloReply = (plus ) ?: this @Suppress("UNCHECKED_CAST") -private fun HelloReply.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): HelloReply { +private fun HelloReply.Companion.decodeWithImpl(u: pbandk.MessageDecoder): HelloReply { var message = "" val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> diff --git a/examples/gradle-and-jvm/src/main/kotlin/pbandk/examples/addressbook/Main.kt b/examples/gradle-and-jvm/src/main/kotlin/pbandk/examples/addressbook/Main.kt index 6ebe704d..9bf9ba3f 100644 --- a/examples/gradle-and-jvm/src/main/kotlin/pbandk/examples/addressbook/Main.kt +++ b/examples/gradle-and-jvm/src/main/kotlin/pbandk/examples/addressbook/Main.kt @@ -1,9 +1,9 @@ package pbandk.examples.addressbook +import pbandk.decodeFromByteArray +import pbandk.encodeToByteArray import pbandk.examples.addressbook.pb.AddressBook import pbandk.examples.addressbook.pb.Person -import pbandk.protoMarshal -import pbandk.protoUnmarshal import java.nio.file.Files import java.nio.file.Paths @@ -54,10 +54,10 @@ fun addPerson(fileName: String) { } ) // Save it back out - Files.write(Paths.get(fileName), book.copy(people = book.people + person).protoMarshal()) + Files.write(Paths.get(fileName), book.copy(people = book.people + person).encodeToByteArray()) } fun readBook(fileName: String) = Paths.get(fileName).let { filePath -> if (!Files.isRegularFile(filePath)) null - else AddressBook.protoUnmarshal(Files.readAllBytes(filePath)) + else AddressBook.decodeFromByteArray(Files.readAllBytes(filePath)) } diff --git a/examples/gradle-and-jvm/src/main/kotlin/pbandk/examples/addressbook/pb/addressbook.kt b/examples/gradle-and-jvm/src/main/kotlin/pbandk/examples/addressbook/pb/addressbook.kt index 199c02b0..c9e8cd7b 100644 --- a/examples/gradle-and-jvm/src/main/kotlin/pbandk/examples/addressbook/pb/addressbook.kt +++ b/examples/gradle-and-jvm/src/main/kotlin/pbandk/examples/addressbook/pb/addressbook.kt @@ -15,7 +15,7 @@ data class Person( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { Person() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = Person.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = Person.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -94,7 +94,7 @@ data class Person( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { Person.PhoneNumber() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = Person.PhoneNumber.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = Person.PhoneNumber.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -133,7 +133,7 @@ data class AddressBook( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { AddressBook() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = AddressBook.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = AddressBook.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -163,7 +163,7 @@ private fun Person.protoMergeImpl(plus: pbandk.Message?): Person = (plus as? Per ) ?: this @Suppress("UNCHECKED_CAST") -private fun Person.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): Person { +private fun Person.Companion.decodeWithImpl(u: pbandk.MessageDecoder): Person { var name = "" var id = 0 var email = "" @@ -190,7 +190,7 @@ private fun Person.PhoneNumber.protoMergeImpl(plus: pbandk.Message?): Person.Pho ) ?: this @Suppress("UNCHECKED_CAST") -private fun Person.PhoneNumber.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): Person.PhoneNumber { +private fun Person.PhoneNumber.Companion.decodeWithImpl(u: pbandk.MessageDecoder): Person.PhoneNumber { var number = "" var type: pbandk.examples.addressbook.pb.Person.PhoneType = pbandk.examples.addressbook.pb.Person.PhoneType.fromValue(0) @@ -211,7 +211,7 @@ private fun AddressBook.protoMergeImpl(plus: pbandk.Message?): AddressBook = (pl ) ?: this @Suppress("UNCHECKED_CAST") -private fun AddressBook.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): AddressBook { +private fun AddressBook.Companion.decodeWithImpl(u: pbandk.MessageDecoder): AddressBook { var people: pbandk.ListWithSize.Builder? = null val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> diff --git a/protoc-gen-kotlin/lib/src/commonMain/kotlin/pbandk/gen/CodeGenerator.kt b/protoc-gen-kotlin/lib/src/commonMain/kotlin/pbandk/gen/CodeGenerator.kt index a8ec79f1..c392d606 100644 --- a/protoc-gen-kotlin/lib/src/commonMain/kotlin/pbandk/gen/CodeGenerator.kt +++ b/protoc-gen-kotlin/lib/src/commonMain/kotlin/pbandk/gen/CodeGenerator.kt @@ -78,7 +78,7 @@ open class CodeGenerator( // Companion object line("companion object : pbandk.Message.Companion<${typeName}> {").indented { line("val defaultInstance by lazy { ${typeName}() }") - line("override fun unmarshal(u: pbandk.MessageUnmarshaller) = ${typeName}.unmarshalImpl(u)") + line("override fun decodeWith(u: pbandk.MessageDecoder) = ${typeName}.decodeWithImpl(u)") line() writeMessageDescriptor(type, typeName) }.line("}") @@ -147,7 +147,7 @@ open class CodeGenerator( val fullTypeName = if (parentType == null) type.kotlinTypeName else "$parentType.${type.kotlinTypeName}" writeMessageOrDefaultExtension(type, fullTypeName) writeMessageMergeExtension(type, fullTypeName) - writeMessageUnmarshalExtension(type, fullTypeName) + writeMessageDecodeWithExtension(type, fullTypeName) type.nestedTypes.filterIsInstance().forEach { writeMessageExtensions(it, fullTypeName) } } @@ -212,20 +212,20 @@ open class CodeGenerator( }.line(") ?: this") } - protected fun writeMessageUnmarshalExtension(type: File.Type.Message, fullTypeName: String) { + protected fun writeMessageDecodeWithExtension(type: File.Type.Message, fullTypeName: String) { val lineStr = "private fun $fullTypeName.Companion." + - "unmarshalImpl(u: pbandk.MessageUnmarshaller): $fullTypeName {" + "decodeWithImpl(u: pbandk.MessageDecoder): $fullTypeName {" line().line("@Suppress(\"UNCHECKED_CAST\")").line(lineStr).indented { // A bunch of locals for each field, initialized with defaults val doneKotlinFields = type.fields.map { when (it) { is File.Field.Numbered.Standard -> { - line(it.unmarshalVarDecl) - it.unmarshalVarDone + line(it.decodeWithVarDecl) + it.decodeWithVarDone } is File.Field.Numbered.Wrapper -> { - line(it.unmarshalVarDecl) - it.unmarshalVarDone + line(it.decodeWithVarDecl) + it.decodeWithVarDone } is File.Field.OneOf -> { line("var ${it.kotlinFieldName}: $fullTypeName.${it.kotlinTypeName}<*>? = null") @@ -359,7 +359,7 @@ open class CodeGenerator( kotlinLocalTypeName ?: localTypeName?.let { kotlinTypeMappings.getOrElse(it) { error("Unable to find mapping for $it") } } ?: type.standardTypeName - protected val File.Field.Numbered.Standard.unmarshalVarDecl get() = when { + protected val File.Field.Numbered.Standard.decodeWithVarDecl get() = when { repeated -> mapEntry().let { mapEntry -> if (mapEntry == null) "var $kotlinFieldName: pbandk.ListWithSize.Builder<$kotlinQualifiedTypeName>? = null" else "var $kotlinFieldName: pbandk.MessageMap.Builder<" + @@ -368,7 +368,7 @@ open class CodeGenerator( requiresExplicitTypeWithVal -> "var $kotlinFieldName: ${kotlinValueType(true)} = $defaultValue" else -> "var $kotlinFieldName = $defaultValue" } - protected val File.Field.Numbered.Standard.unmarshalVarDone get() = + protected val File.Field.Numbered.Standard.decodeWithVarDone get() = if (map) "pbandk.MessageMap.Builder.fixed($kotlinFieldName)" else if (repeated) "pbandk.ListWithSize.Builder.fixed($kotlinFieldName)" else kotlinFieldName @@ -389,11 +389,11 @@ open class CodeGenerator( protected val File.Field.Numbered.Standard.requiresExplicitTypeWithVal get() = repeated || hasPresence || type.requiresExplicitTypeWithVal - protected val File.Field.Numbered.Wrapper.unmarshalVarDecl get() = when { + protected val File.Field.Numbered.Wrapper.decodeWithVarDecl get() = when { repeated -> "var $kotlinFieldName: pbandk.ListWithSize.Builder<${wrappedType.standardTypeName}>? = null" else -> "var $kotlinFieldName: ${wrappedType.standardTypeName}? = $defaultValue" } - protected val File.Field.Numbered.Wrapper.unmarshalVarDone get() = when { + protected val File.Field.Numbered.Wrapper.decodeWithVarDone get() = when { repeated -> "pbandk.ListWithSize.Builder.fixed($kotlinFieldName)" else -> kotlinFieldName } diff --git a/protoc-gen-kotlin/lib/src/commonMain/kotlin/pbandk/gen/Namer.kt b/protoc-gen-kotlin/lib/src/commonMain/kotlin/pbandk/gen/Namer.kt index 019e888f..21450bc1 100644 --- a/protoc-gen-kotlin/lib/src/commonMain/kotlin/pbandk/gen/Namer.kt +++ b/protoc-gen-kotlin/lib/src/commonMain/kotlin/pbandk/gen/Namer.kt @@ -22,8 +22,10 @@ interface Namer { "Boolean", "Companion", "Double", "Float", "Int", "List", "Long", "Map", "String" ) val disallowedFieldNames = setOf( - "descriptor", "emptyList", "jsonMarshal", "jsonUnmarshal", "marshal", "pbandk", "plus", - "protoMarshal", "protoSize", "protoUnmarshal", "unknownFields", "unmarshal" + "decodeWith", "descriptor", "emptyList", "encodeWith", "pbandk", "plus", "protoSize", "unknownFields" + ) + val disallowedFieldNamePrefixes = setOf( + "decodeFrom", "encodeTo" ) val disallowedValueTypeNames = disallowedTypeNames + setOf( "UNRECOGNIZED" @@ -43,6 +45,7 @@ interface Namer { override fun newFieldName(preferred: String, nameSet: Collection): String { var name = underscoreToCamelCase(preferred).decapitalize() while (nameSet.contains(name) || disallowedFieldNames.contains(name)) name += '_' + if (disallowedFieldNamePrefixes.any { name.startsWith(it) } && !name.endsWith('_')) name += '_' if (kotlinKeywords.contains(name)) name = "`$name`" return name } diff --git a/protoc-gen-kotlin/lib/src/commonMain/kotlin/pbandk/gen/pb/plugin.kt b/protoc-gen-kotlin/lib/src/commonMain/kotlin/pbandk/gen/pb/plugin.kt index 57c96377..2e695818 100644 --- a/protoc-gen-kotlin/lib/src/commonMain/kotlin/pbandk/gen/pb/plugin.kt +++ b/protoc-gen-kotlin/lib/src/commonMain/kotlin/pbandk/gen/pb/plugin.kt @@ -14,7 +14,7 @@ data class Version( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { Version() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = Version.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = Version.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -71,7 +71,7 @@ data class CodeGeneratorRequest( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { CodeGeneratorRequest() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = CodeGeneratorRequest.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = CodeGeneratorRequest.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -126,7 +126,7 @@ data class CodeGeneratorResponse( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { CodeGeneratorResponse() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = CodeGeneratorResponse.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = CodeGeneratorResponse.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -165,7 +165,7 @@ data class CodeGeneratorResponse( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { CodeGeneratorResponse.File() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = CodeGeneratorResponse.File.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = CodeGeneratorResponse.File.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -214,7 +214,7 @@ private fun Version.protoMergeImpl(plus: pbandk.Message?): Version = (plus as? V ) ?: this @Suppress("UNCHECKED_CAST") -private fun Version.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): Version { +private fun Version.Companion.decodeWithImpl(u: pbandk.MessageDecoder): Version { var major: Int? = null var minor: Int? = null var patch: Int? = null @@ -242,7 +242,7 @@ private fun CodeGeneratorRequest.protoMergeImpl(plus: pbandk.Message?): CodeGene ) ?: this @Suppress("UNCHECKED_CAST") -private fun CodeGeneratorRequest.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): CodeGeneratorRequest { +private fun CodeGeneratorRequest.Companion.decodeWithImpl(u: pbandk.MessageDecoder): CodeGeneratorRequest { var fileToGenerate: pbandk.ListWithSize.Builder? = null var parameter: String? = null var protoFile: pbandk.ListWithSize.Builder? = null @@ -268,7 +268,7 @@ private fun CodeGeneratorResponse.protoMergeImpl(plus: pbandk.Message?): CodeGen ) ?: this @Suppress("UNCHECKED_CAST") -private fun CodeGeneratorResponse.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): CodeGeneratorResponse { +private fun CodeGeneratorResponse.Companion.decodeWithImpl(u: pbandk.MessageDecoder): CodeGeneratorResponse { var error: String? = null var file: pbandk.ListWithSize.Builder? = null @@ -291,7 +291,7 @@ private fun CodeGeneratorResponse.File.protoMergeImpl(plus: pbandk.Message?): Co ) ?: this @Suppress("UNCHECKED_CAST") -private fun CodeGeneratorResponse.File.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): CodeGeneratorResponse.File { +private fun CodeGeneratorResponse.File.Companion.decodeWithImpl(u: pbandk.MessageDecoder): CodeGeneratorResponse.File { var name: String? = null var insertionPoint: String? = null var content: String? = null diff --git a/protoc-gen-kotlin/lib/src/jvmMain/kotlin/pbandk/gen/Platform.kt b/protoc-gen-kotlin/lib/src/jvmMain/kotlin/pbandk/gen/Platform.kt index 6b210899..3c7a7bd7 100644 --- a/protoc-gen-kotlin/lib/src/jvmMain/kotlin/pbandk/gen/Platform.kt +++ b/protoc-gen-kotlin/lib/src/jvmMain/kotlin/pbandk/gen/Platform.kt @@ -3,25 +3,25 @@ package pbandk.gen import com.google.protobuf.compiler.PluginProtos import pbandk.gen.pb.CodeGeneratorRequest import pbandk.gen.pb.CodeGeneratorResponse -import pbandk.protoMarshal -import pbandk.protoUnmarshal +import pbandk.encodeToByteArray +import pbandk.decodeFromByteArray import java.io.File import java.lang.RuntimeException import java.net.URLClassLoader import java.util.* -// Set this to false to use the JVM marshal/unmarshal for code gen proto +// Set this to false to use the JVM encode/decode for code gen proto const val useJvmProto = false actual object Platform { actual fun stderrPrintln(str: String) = System.err.println(str) actual fun stdinReadRequest() = System.`in`.readBytes().let { bytes -> if (useJvmProto) BootstrapConverter.fromReq(PluginProtos.CodeGeneratorRequest.parseFrom(bytes)) - else CodeGeneratorRequest.protoUnmarshal(bytes) + else CodeGeneratorRequest.decodeFromByteArray(bytes) } actual fun stdoutWriteResponse(resp: CodeGeneratorResponse) = if (useJvmProto) BootstrapConverter.toResp(resp).writeTo(System.out) - else System.out.write(resp.protoMarshal()) + else System.out.write(resp.encodeToByteArray()) actual fun serviceGenerator(cliParams: Map): ServiceGenerator? { // CLI param kotlin_service_gen is a collection of JARs. At the very end can have a pipe with the diff --git a/runtime/api/runtime.api b/runtime/api/runtime.api index 58287bd4..db21a210 100644 --- a/runtime/api/runtime.api +++ b/runtime/api/runtime.api @@ -231,8 +231,8 @@ public abstract interface class pbandk/Message { } public abstract interface class pbandk/Message$Companion { + public abstract fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; public abstract fun getDescriptor ()Lpbandk/MessageDescriptor; - public abstract fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; } public final class pbandk/Message$DefaultImpls { @@ -257,6 +257,10 @@ public abstract class pbandk/Message$OneOf { public fun toString ()Ljava/lang/String; } +public abstract interface class pbandk/MessageDecoder { + public abstract fun readMessage (Lpbandk/Message$Companion;Lkotlin/jvm/functions/Function2;)Ljava/util/Map; +} + public final class pbandk/MessageDescriptor { public fun (Lkotlin/reflect/KClass;Lpbandk/Message$Companion;Ljava/util/Collection;)V public final fun getFields ()Ljava/util/Collection; @@ -264,17 +268,21 @@ public final class pbandk/MessageDescriptor { public final fun getMessageCompanion ()Lpbandk/Message$Companion; } +public abstract interface class pbandk/MessageEncoder { + public abstract fun writeMessage (Lpbandk/Message;)V +} + public final class pbandk/MessageExtensionsJvmKt { - public static final fun protoMarshal (Lpbandk/Message;Ljava/io/OutputStream;)V - public static final fun protoUnmarshal (Lpbandk/Message$Companion;Ljava/io/InputStream;)Lpbandk/Message; - public static final fun protoUnmarshal (Lpbandk/Message$Companion;Ljava/nio/ByteBuffer;)Lpbandk/Message; + public static final fun decodeFromByteBuffer (Lpbandk/Message$Companion;Ljava/nio/ByteBuffer;)Lpbandk/Message; + public static final fun decodeFromStream (Lpbandk/Message$Companion;Ljava/io/InputStream;)Lpbandk/Message; + public static final fun encodeToStream (Lpbandk/Message;Ljava/io/OutputStream;)V } public final class pbandk/MessageKt { - public static final fun marshal (Lpbandk/Message;Lpbandk/MessageMarshaller;)V + public static final fun decodeFromByteArray (Lpbandk/Message$Companion;[B)Lpbandk/Message; + public static final fun encodeToByteArray (Lpbandk/Message;)[B + public static final fun encodeWith (Lpbandk/Message;Lpbandk/MessageEncoder;)V public static final fun plus (Lpbandk/Message;Lpbandk/Message;)Lpbandk/Message; - public static final fun protoMarshal (Lpbandk/Message;)[B - public static final fun protoUnmarshal (Lpbandk/Message$Companion;[B)Lpbandk/Message; } public final class pbandk/MessageMap : kotlin/collections/AbstractMap { @@ -312,17 +320,9 @@ public final class pbandk/MessageMap$Entry : java/util/Map$Entry, kotlin/jvm/int public final class pbandk/MessageMap$Entry$Companion : pbandk/Message$Companion { public fun (Lpbandk/FieldDescriptor$Type;Lpbandk/FieldDescriptor$Type;)V + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/MessageMap$Entry; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/MessageMap$Entry; -} - -public abstract interface class pbandk/MessageMarshaller { - public abstract fun writeMessage (Lpbandk/Message;)V -} - -public abstract interface class pbandk/MessageUnmarshaller { - public abstract fun readMessage (Lpbandk/Message$Companion;Lkotlin/jvm/functions/Function2;)Ljava/util/Map; } public abstract interface annotation class pbandk/PbandkInternal : java/lang/annotation/Annotation { @@ -450,10 +450,10 @@ public final class pbandk/json/JsonConfig$Companion { } public final class pbandk/json/MessageExtensionsKt { - public static final fun jsonMarshal (Lpbandk/Message;Lpbandk/json/JsonConfig;)Ljava/lang/String; - public static synthetic fun jsonMarshal$default (Lpbandk/Message;Lpbandk/json/JsonConfig;ILjava/lang/Object;)Ljava/lang/String; - public static final fun jsonUnmarshal (Lpbandk/Message$Companion;Ljava/lang/String;Lpbandk/json/JsonConfig;)Lpbandk/Message; - public static synthetic fun jsonUnmarshal$default (Lpbandk/Message$Companion;Ljava/lang/String;Lpbandk/json/JsonConfig;ILjava/lang/Object;)Lpbandk/Message; + public static final fun decodeFromJsonString (Lpbandk/Message$Companion;Ljava/lang/String;Lpbandk/json/JsonConfig;)Lpbandk/Message; + public static synthetic fun decodeFromJsonString$default (Lpbandk/Message$Companion;Ljava/lang/String;Lpbandk/json/JsonConfig;ILjava/lang/Object;)Lpbandk/Message; + public static final fun encodeToJsonString (Lpbandk/Message;Lpbandk/json/JsonConfig;)Ljava/lang/String; + public static synthetic fun encodeToJsonString$default (Lpbandk/Message;Lpbandk/json/JsonConfig;ILjava/lang/Object;)Ljava/lang/String; } public final class pbandk/wkt/Any : pbandk/Message { @@ -479,10 +479,10 @@ public final class pbandk/wkt/Any : pbandk/Message { } public final class pbandk/wkt/Any$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/Any; public final fun getDefaultInstance ()Lpbandk/wkt/Any; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/Any; } public final class pbandk/wkt/AnyKt { @@ -522,10 +522,10 @@ public final class pbandk/wkt/Api : pbandk/Message { } public final class pbandk/wkt/Api$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/Api; public final fun getDefaultInstance ()Lpbandk/wkt/Api; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/Api; } public final class pbandk/wkt/ApiKt { @@ -555,10 +555,10 @@ public final class pbandk/wkt/BoolValue : pbandk/Message { } public final class pbandk/wkt/BoolValue$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/BoolValue; public final fun getDefaultInstance ()Lpbandk/wkt/BoolValue; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/BoolValue; } public final class pbandk/wkt/BytesValue : pbandk/Message { @@ -582,10 +582,10 @@ public final class pbandk/wkt/BytesValue : pbandk/Message { } public final class pbandk/wkt/BytesValue$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/BytesValue; public final fun getDefaultInstance ()Lpbandk/wkt/BytesValue; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/BytesValue; } public final class pbandk/wkt/DescriptorKt { @@ -657,10 +657,10 @@ public final class pbandk/wkt/DescriptorProto : pbandk/Message { } public final class pbandk/wkt/DescriptorProto$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/DescriptorProto; public final fun getDefaultInstance ()Lpbandk/wkt/DescriptorProto; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/DescriptorProto; } public final class pbandk/wkt/DescriptorProto$ExtensionRange : pbandk/Message { @@ -688,10 +688,10 @@ public final class pbandk/wkt/DescriptorProto$ExtensionRange : pbandk/Message { } public final class pbandk/wkt/DescriptorProto$ExtensionRange$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/DescriptorProto$ExtensionRange; public final fun getDefaultInstance ()Lpbandk/wkt/DescriptorProto$ExtensionRange; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/DescriptorProto$ExtensionRange; } public final class pbandk/wkt/DescriptorProto$ReservedRange : pbandk/Message { @@ -717,10 +717,10 @@ public final class pbandk/wkt/DescriptorProto$ReservedRange : pbandk/Message { } public final class pbandk/wkt/DescriptorProto$ReservedRange$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/DescriptorProto$ReservedRange; public final fun getDefaultInstance ()Lpbandk/wkt/DescriptorProto$ReservedRange; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/DescriptorProto$ReservedRange; } public final class pbandk/wkt/DoubleValue : pbandk/Message { @@ -744,10 +744,10 @@ public final class pbandk/wkt/DoubleValue : pbandk/Message { } public final class pbandk/wkt/DoubleValue$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/DoubleValue; public final fun getDefaultInstance ()Lpbandk/wkt/DoubleValue; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/DoubleValue; } public final class pbandk/wkt/Duration : pbandk/Message { @@ -773,10 +773,10 @@ public final class pbandk/wkt/Duration : pbandk/Message { } public final class pbandk/wkt/Duration$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/Duration; public final fun getDefaultInstance ()Lpbandk/wkt/Duration; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/Duration; } public final class pbandk/wkt/DurationKt { @@ -802,10 +802,10 @@ public final class pbandk/wkt/Empty : pbandk/Message { } public final class pbandk/wkt/Empty$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/Empty; public final fun getDefaultInstance ()Lpbandk/wkt/Empty; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/Empty; } public final class pbandk/wkt/EmptyKt { @@ -841,10 +841,10 @@ public final class pbandk/wkt/Enum : pbandk/Message { } public final class pbandk/wkt/Enum$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/Enum; public final fun getDefaultInstance ()Lpbandk/wkt/Enum; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/Enum; } public final class pbandk/wkt/EnumDescriptorProto : pbandk/Message { @@ -876,10 +876,10 @@ public final class pbandk/wkt/EnumDescriptorProto : pbandk/Message { } public final class pbandk/wkt/EnumDescriptorProto$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/EnumDescriptorProto; public final fun getDefaultInstance ()Lpbandk/wkt/EnumDescriptorProto; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/EnumDescriptorProto; } public final class pbandk/wkt/EnumDescriptorProto$EnumReservedRange : pbandk/Message { @@ -905,10 +905,10 @@ public final class pbandk/wkt/EnumDescriptorProto$EnumReservedRange : pbandk/Mes } public final class pbandk/wkt/EnumDescriptorProto$EnumReservedRange$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/EnumDescriptorProto$EnumReservedRange; public final fun getDefaultInstance ()Lpbandk/wkt/EnumDescriptorProto$EnumReservedRange; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/EnumDescriptorProto$EnumReservedRange; } public final class pbandk/wkt/EnumOptions : pbandk/Message { @@ -936,10 +936,10 @@ public final class pbandk/wkt/EnumOptions : pbandk/Message { } public final class pbandk/wkt/EnumOptions$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/EnumOptions; public final fun getDefaultInstance ()Lpbandk/wkt/EnumOptions; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/EnumOptions; } public final class pbandk/wkt/EnumValue : pbandk/Message { @@ -967,10 +967,10 @@ public final class pbandk/wkt/EnumValue : pbandk/Message { } public final class pbandk/wkt/EnumValue$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/EnumValue; public final fun getDefaultInstance ()Lpbandk/wkt/EnumValue; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/EnumValue; } public final class pbandk/wkt/EnumValueDescriptorProto : pbandk/Message { @@ -998,10 +998,10 @@ public final class pbandk/wkt/EnumValueDescriptorProto : pbandk/Message { } public final class pbandk/wkt/EnumValueDescriptorProto$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/EnumValueDescriptorProto; public final fun getDefaultInstance ()Lpbandk/wkt/EnumValueDescriptorProto; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/EnumValueDescriptorProto; } public final class pbandk/wkt/EnumValueOptions : pbandk/Message { @@ -1027,10 +1027,10 @@ public final class pbandk/wkt/EnumValueOptions : pbandk/Message { } public final class pbandk/wkt/EnumValueOptions$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/EnumValueOptions; public final fun getDefaultInstance ()Lpbandk/wkt/EnumValueOptions; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/EnumValueOptions; } public final class pbandk/wkt/ExtensionRangeOptions : pbandk/Message { @@ -1054,10 +1054,10 @@ public final class pbandk/wkt/ExtensionRangeOptions : pbandk/Message { } public final class pbandk/wkt/ExtensionRangeOptions$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/ExtensionRangeOptions; public final fun getDefaultInstance ()Lpbandk/wkt/ExtensionRangeOptions; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/ExtensionRangeOptions; } public final class pbandk/wkt/Field : pbandk/Message { @@ -1137,10 +1137,10 @@ public final class pbandk/wkt/Field$Cardinality$UNRECOGNIZED : pbandk/wkt/Field$ } public final class pbandk/wkt/Field$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/Field; public final fun getDefaultInstance ()Lpbandk/wkt/Field; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/Field; } public abstract class pbandk/wkt/Field$Kind : pbandk/Message$Enum { @@ -1280,10 +1280,10 @@ public final class pbandk/wkt/FieldDescriptorProto : pbandk/Message { } public final class pbandk/wkt/FieldDescriptorProto$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/FieldDescriptorProto; public final fun getDefaultInstance ()Lpbandk/wkt/FieldDescriptorProto; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/FieldDescriptorProto; } public abstract class pbandk/wkt/FieldDescriptorProto$Label : pbandk/Message$Enum { @@ -1435,10 +1435,10 @@ public final class pbandk/wkt/FieldMask : pbandk/Message { } public final class pbandk/wkt/FieldMask$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/FieldMask; public final fun getDefaultInstance ()Lpbandk/wkt/FieldMask; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/FieldMask; } public final class pbandk/wkt/FieldOptions : pbandk/Message { @@ -1508,10 +1508,10 @@ public final class pbandk/wkt/FieldOptions$CType$UNRECOGNIZED : pbandk/wkt/Field } public final class pbandk/wkt/FieldOptions$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/FieldOptions; public final fun getDefaultInstance ()Lpbandk/wkt/FieldOptions; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/FieldOptions; } public abstract class pbandk/wkt/FieldOptions$JSType : pbandk/Message$Enum { @@ -1595,10 +1595,10 @@ public final class pbandk/wkt/FileDescriptorProto : pbandk/Message { } public final class pbandk/wkt/FileDescriptorProto$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/FileDescriptorProto; public final fun getDefaultInstance ()Lpbandk/wkt/FileDescriptorProto; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/FileDescriptorProto; } public final class pbandk/wkt/FileDescriptorSet : pbandk/Message { @@ -1622,10 +1622,10 @@ public final class pbandk/wkt/FileDescriptorSet : pbandk/Message { } public final class pbandk/wkt/FileDescriptorSet$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/FileDescriptorSet; public final fun getDefaultInstance ()Lpbandk/wkt/FileDescriptorSet; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/FileDescriptorSet; } public final class pbandk/wkt/FileOptions : pbandk/Message { @@ -1689,10 +1689,10 @@ public final class pbandk/wkt/FileOptions : pbandk/Message { } public final class pbandk/wkt/FileOptions$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/FileOptions; public final fun getDefaultInstance ()Lpbandk/wkt/FileOptions; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/FileOptions; } public abstract class pbandk/wkt/FileOptions$OptimizeMode : pbandk/Message$Enum { @@ -1750,10 +1750,10 @@ public final class pbandk/wkt/FloatValue : pbandk/Message { } public final class pbandk/wkt/FloatValue$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/FloatValue; public final fun getDefaultInstance ()Lpbandk/wkt/FloatValue; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/FloatValue; } public final class pbandk/wkt/GeneratedCodeInfo : pbandk/Message { @@ -1803,17 +1803,17 @@ public final class pbandk/wkt/GeneratedCodeInfo$Annotation : pbandk/Message { } public final class pbandk/wkt/GeneratedCodeInfo$Annotation$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/GeneratedCodeInfo$Annotation; public final fun getDefaultInstance ()Lpbandk/wkt/GeneratedCodeInfo$Annotation; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/GeneratedCodeInfo$Annotation; } public final class pbandk/wkt/GeneratedCodeInfo$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/GeneratedCodeInfo; public final fun getDefaultInstance ()Lpbandk/wkt/GeneratedCodeInfo; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/GeneratedCodeInfo; } public final class pbandk/wkt/Int32Value : pbandk/Message { @@ -1837,10 +1837,10 @@ public final class pbandk/wkt/Int32Value : pbandk/Message { } public final class pbandk/wkt/Int32Value$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/Int32Value; public final fun getDefaultInstance ()Lpbandk/wkt/Int32Value; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/Int32Value; } public final class pbandk/wkt/Int64Value : pbandk/Message { @@ -1864,10 +1864,10 @@ public final class pbandk/wkt/Int64Value : pbandk/Message { } public final class pbandk/wkt/Int64Value$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/Int64Value; public final fun getDefaultInstance ()Lpbandk/wkt/Int64Value; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/Int64Value; } public final class pbandk/wkt/ListValue : pbandk/Message { @@ -1891,10 +1891,10 @@ public final class pbandk/wkt/ListValue : pbandk/Message { } public final class pbandk/wkt/ListValue$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/ListValue; public final fun getDefaultInstance ()Lpbandk/wkt/ListValue; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/ListValue; } public final class pbandk/wkt/MessageOptions : pbandk/Message { @@ -1926,10 +1926,10 @@ public final class pbandk/wkt/MessageOptions : pbandk/Message { } public final class pbandk/wkt/MessageOptions$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/MessageOptions; public final fun getDefaultInstance ()Lpbandk/wkt/MessageOptions; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/MessageOptions; } public final class pbandk/wkt/Method : pbandk/Message { @@ -1965,10 +1965,10 @@ public final class pbandk/wkt/Method : pbandk/Message { } public final class pbandk/wkt/Method$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/Method; public final fun getDefaultInstance ()Lpbandk/wkt/Method; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/Method; } public final class pbandk/wkt/MethodDescriptorProto : pbandk/Message { @@ -2002,10 +2002,10 @@ public final class pbandk/wkt/MethodDescriptorProto : pbandk/Message { } public final class pbandk/wkt/MethodDescriptorProto$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/MethodDescriptorProto; public final fun getDefaultInstance ()Lpbandk/wkt/MethodDescriptorProto; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/MethodDescriptorProto; } public final class pbandk/wkt/MethodOptions : pbandk/Message { @@ -2033,10 +2033,10 @@ public final class pbandk/wkt/MethodOptions : pbandk/Message { } public final class pbandk/wkt/MethodOptions$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/MethodOptions; public final fun getDefaultInstance ()Lpbandk/wkt/MethodOptions; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/MethodOptions; } public abstract class pbandk/wkt/MethodOptions$IdempotencyLevel : pbandk/Message$Enum { @@ -2096,10 +2096,10 @@ public final class pbandk/wkt/Mixin : pbandk/Message { } public final class pbandk/wkt/Mixin$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/Mixin; public final fun getDefaultInstance ()Lpbandk/wkt/Mixin; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/Mixin; } public abstract class pbandk/wkt/NullValue : pbandk/Message$Enum { @@ -2151,10 +2151,10 @@ public final class pbandk/wkt/OneofDescriptorProto : pbandk/Message { } public final class pbandk/wkt/OneofDescriptorProto$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/OneofDescriptorProto; public final fun getDefaultInstance ()Lpbandk/wkt/OneofDescriptorProto; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/OneofDescriptorProto; } public final class pbandk/wkt/OneofOptions : pbandk/Message { @@ -2178,10 +2178,10 @@ public final class pbandk/wkt/OneofOptions : pbandk/Message { } public final class pbandk/wkt/OneofOptions$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/OneofOptions; public final fun getDefaultInstance ()Lpbandk/wkt/OneofOptions; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/OneofOptions; } public final class pbandk/wkt/Option : pbandk/Message { @@ -2207,10 +2207,10 @@ public final class pbandk/wkt/Option : pbandk/Message { } public final class pbandk/wkt/Option$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/Option; public final fun getDefaultInstance ()Lpbandk/wkt/Option; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/Option; } public final class pbandk/wkt/ServiceDescriptorProto : pbandk/Message { @@ -2238,10 +2238,10 @@ public final class pbandk/wkt/ServiceDescriptorProto : pbandk/Message { } public final class pbandk/wkt/ServiceDescriptorProto$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/ServiceDescriptorProto; public final fun getDefaultInstance ()Lpbandk/wkt/ServiceDescriptorProto; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/ServiceDescriptorProto; } public final class pbandk/wkt/ServiceOptions : pbandk/Message { @@ -2267,10 +2267,10 @@ public final class pbandk/wkt/ServiceOptions : pbandk/Message { } public final class pbandk/wkt/ServiceOptions$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/ServiceOptions; public final fun getDefaultInstance ()Lpbandk/wkt/ServiceOptions; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/ServiceOptions; } public final class pbandk/wkt/SourceCodeInfo : pbandk/Message { @@ -2294,10 +2294,10 @@ public final class pbandk/wkt/SourceCodeInfo : pbandk/Message { } public final class pbandk/wkt/SourceCodeInfo$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/SourceCodeInfo; public final fun getDefaultInstance ()Lpbandk/wkt/SourceCodeInfo; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/SourceCodeInfo; } public final class pbandk/wkt/SourceCodeInfo$Location : pbandk/Message { @@ -2329,10 +2329,10 @@ public final class pbandk/wkt/SourceCodeInfo$Location : pbandk/Message { } public final class pbandk/wkt/SourceCodeInfo$Location$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/SourceCodeInfo$Location; public final fun getDefaultInstance ()Lpbandk/wkt/SourceCodeInfo$Location; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/SourceCodeInfo$Location; } public final class pbandk/wkt/SourceContext : pbandk/Message { @@ -2356,10 +2356,10 @@ public final class pbandk/wkt/SourceContext : pbandk/Message { } public final class pbandk/wkt/SourceContext$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/SourceContext; public final fun getDefaultInstance ()Lpbandk/wkt/SourceContext; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/SourceContext; } public final class pbandk/wkt/Source_contextKt { @@ -2387,10 +2387,10 @@ public final class pbandk/wkt/StringValue : pbandk/Message { } public final class pbandk/wkt/StringValue$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/StringValue; public final fun getDefaultInstance ()Lpbandk/wkt/StringValue; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/StringValue; } public final class pbandk/wkt/Struct : pbandk/Message { @@ -2414,10 +2414,10 @@ public final class pbandk/wkt/Struct : pbandk/Message { } public final class pbandk/wkt/Struct$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/Struct; public final fun getDefaultInstance ()Lpbandk/wkt/Struct; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/Struct; } public final class pbandk/wkt/Struct$FieldsEntry : java/util/Map$Entry, kotlin/jvm/internal/markers/KMappedMarker, pbandk/Message { @@ -2447,10 +2447,10 @@ public final class pbandk/wkt/Struct$FieldsEntry : java/util/Map$Entry, kotlin/j } public final class pbandk/wkt/Struct$FieldsEntry$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/Struct$FieldsEntry; public final fun getDefaultInstance ()Lpbandk/wkt/Struct$FieldsEntry; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/Struct$FieldsEntry; } public final class pbandk/wkt/StructKt { @@ -2513,10 +2513,10 @@ public final class pbandk/wkt/Timestamp : pbandk/Message { } public final class pbandk/wkt/Timestamp$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/Timestamp; public final fun getDefaultInstance ()Lpbandk/wkt/Timestamp; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/Timestamp; } public final class pbandk/wkt/TimestampKt { @@ -2554,10 +2554,10 @@ public final class pbandk/wkt/Type : pbandk/Message { } public final class pbandk/wkt/Type$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/Type; public final fun getDefaultInstance ()Lpbandk/wkt/Type; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/Type; } public final class pbandk/wkt/TypeKt { @@ -2589,10 +2589,10 @@ public final class pbandk/wkt/UInt32Value : pbandk/Message { } public final class pbandk/wkt/UInt32Value$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/UInt32Value; public final fun getDefaultInstance ()Lpbandk/wkt/UInt32Value; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/UInt32Value; } public final class pbandk/wkt/UInt64Value : pbandk/Message { @@ -2616,10 +2616,10 @@ public final class pbandk/wkt/UInt64Value : pbandk/Message { } public final class pbandk/wkt/UInt64Value$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/UInt64Value; public final fun getDefaultInstance ()Lpbandk/wkt/UInt64Value; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/UInt64Value; } public final class pbandk/wkt/UninterpretedOption : pbandk/Message { @@ -2655,10 +2655,10 @@ public final class pbandk/wkt/UninterpretedOption : pbandk/Message { } public final class pbandk/wkt/UninterpretedOption$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/UninterpretedOption; public final fun getDefaultInstance ()Lpbandk/wkt/UninterpretedOption; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/UninterpretedOption; } public final class pbandk/wkt/UninterpretedOption$NamePart : pbandk/Message { @@ -2684,10 +2684,10 @@ public final class pbandk/wkt/UninterpretedOption$NamePart : pbandk/Message { } public final class pbandk/wkt/UninterpretedOption$NamePart$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/UninterpretedOption$NamePart; public final fun getDefaultInstance ()Lpbandk/wkt/UninterpretedOption$NamePart; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/UninterpretedOption$NamePart; } public final class pbandk/wkt/Value : pbandk/Message { @@ -2717,10 +2717,10 @@ public final class pbandk/wkt/Value : pbandk/Message { } public final class pbandk/wkt/Value$Companion : pbandk/Message$Companion { + public synthetic fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/Message; + public fun decodeWith (Lpbandk/MessageDecoder;)Lpbandk/wkt/Value; public final fun getDefaultInstance ()Lpbandk/wkt/Value; public fun getDescriptor ()Lpbandk/MessageDescriptor; - public synthetic fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/Message; - public fun unmarshal (Lpbandk/MessageUnmarshaller;)Lpbandk/wkt/Value; } public abstract class pbandk/wkt/Value$Kind : pbandk/Message$OneOf { diff --git a/runtime/src/commonMain/kotlin/pbandk/Message.kt b/runtime/src/commonMain/kotlin/pbandk/Message.kt index a56df5ce..38d26c2c 100644 --- a/runtime/src/commonMain/kotlin/pbandk/Message.kt +++ b/runtime/src/commonMain/kotlin/pbandk/Message.kt @@ -1,8 +1,8 @@ package pbandk import pbandk.internal.binary.Sizer -import pbandk.internal.binary.BinaryMessageMarshaller -import pbandk.internal.binary.BinaryMessageUnmarshaller +import pbandk.internal.binary.BinaryMessageEncoder +import pbandk.internal.binary.BinaryMessageDecoder import pbandk.internal.binary.allocate import pbandk.internal.binary.fromByteArray @@ -15,7 +15,7 @@ interface Message { operator fun plus(other: Message?): Message interface Companion { - fun unmarshal(u: MessageUnmarshaller): T + fun decodeWith(u: MessageDecoder): T val descriptor: MessageDescriptor } @@ -41,13 +41,13 @@ interface Message { } -fun T.marshal(m: MessageMarshaller): Unit = m.writeMessage(this) +fun T.encodeWith(m: MessageEncoder): Unit = m.writeMessage(this) -fun T.protoMarshal(): ByteArray = - BinaryMessageMarshaller.allocate(protoSize).also { marshal(it) }.toByteArray() +fun T.encodeToByteArray(): ByteArray = + BinaryMessageEncoder.allocate(protoSize).also { encodeWith(it) }.toByteArray() -fun Message.Companion.protoUnmarshal(arr: ByteArray): T = - unmarshal(BinaryMessageUnmarshaller.fromByteArray(arr)) +fun Message.Companion.decodeFromByteArray(arr: ByteArray): T = + decodeWith(BinaryMessageDecoder.fromByteArray(arr)) @Suppress("UNCHECKED_CAST") operator fun T?.plus(other: T?): T? = this?.plus(other) as T? ?: other diff --git a/runtime/src/commonMain/kotlin/pbandk/MessageUnmarshaller.kt b/runtime/src/commonMain/kotlin/pbandk/MessageDecoder.kt similarity index 83% rename from runtime/src/commonMain/kotlin/pbandk/MessageUnmarshaller.kt rename to runtime/src/commonMain/kotlin/pbandk/MessageDecoder.kt index ef34c72a..2e296588 100644 --- a/runtime/src/commonMain/kotlin/pbandk/MessageUnmarshaller.kt +++ b/runtime/src/commonMain/kotlin/pbandk/MessageDecoder.kt @@ -1,6 +1,6 @@ package pbandk -interface MessageUnmarshaller { +interface MessageDecoder { fun readMessage( messageCompanion: Message.Companion, fieldFn: (Int, Any) -> Unit diff --git a/runtime/src/commonMain/kotlin/pbandk/MessageMarshaller.kt b/runtime/src/commonMain/kotlin/pbandk/MessageEncoder.kt similarity index 68% rename from runtime/src/commonMain/kotlin/pbandk/MessageMarshaller.kt rename to runtime/src/commonMain/kotlin/pbandk/MessageEncoder.kt index 21e74ff8..8dd8ca0d 100644 --- a/runtime/src/commonMain/kotlin/pbandk/MessageMarshaller.kt +++ b/runtime/src/commonMain/kotlin/pbandk/MessageEncoder.kt @@ -1,5 +1,5 @@ package pbandk -interface MessageMarshaller { +interface MessageEncoder { fun writeMessage(message: T) } diff --git a/runtime/src/commonMain/kotlin/pbandk/MessageMap.kt b/runtime/src/commonMain/kotlin/pbandk/MessageMap.kt index a0cc0efd..0e1596bd 100644 --- a/runtime/src/commonMain/kotlin/pbandk/MessageMap.kt +++ b/runtime/src/commonMain/kotlin/pbandk/MessageMap.kt @@ -32,7 +32,7 @@ class MessageMap internal constructor(override val entries: Set> { @Suppress("UNCHECKED_CAST") - override fun unmarshal(u: MessageUnmarshaller): Entry { + override fun decodeWith(u: MessageDecoder): Entry { var key: K = keyType.defaultValue as K var value: V = valueType.defaultValue as V diff --git a/runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryMessageUnmarshaller.kt b/runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryMessageDecoder.kt similarity index 70% rename from runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryMessageUnmarshaller.kt rename to runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryMessageDecoder.kt index df462372..237d0c5d 100644 --- a/runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryMessageUnmarshaller.kt +++ b/runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryMessageDecoder.kt @@ -31,59 +31,59 @@ private fun FieldDescriptor.Type.allowedWireType(wireType: WireType) = this.wireType == wireType || (this is FieldDescriptor.Type.Repeated<*> && valueType.isPackable && wireType == WireType.LENGTH_DELIMITED) -private val FieldDescriptor.Type.binaryReadFn: BinaryWireUnmarshaller.() -> Any +private val FieldDescriptor.Type.binaryReadFn: BinaryWireDecoder.() -> Any get() { // XXX: The "useless" casts below are required in order to work around a compiler bug in Kotlin 1.3 (see // https://youtrack.jetbrains.com/issue/KT-12693 and linked issues). Without the cast, the compiler crashes // with an obscure error. This is supposedly fixed in Kotlin 1.4. @Suppress("USELESS_CAST") return when (this) { - is FieldDescriptor.Type.Primitive.Double -> BinaryWireUnmarshaller::readDouble as BinaryWireUnmarshaller.() -> Any - is FieldDescriptor.Type.Primitive.Float -> BinaryWireUnmarshaller::readFloat as BinaryWireUnmarshaller.() -> Any - is FieldDescriptor.Type.Primitive.Int64 -> BinaryWireUnmarshaller::readInt64 as BinaryWireUnmarshaller.() -> Any - is FieldDescriptor.Type.Primitive.UInt64 -> BinaryWireUnmarshaller::readUInt64 as BinaryWireUnmarshaller.() -> Any - is FieldDescriptor.Type.Primitive.Int32 -> BinaryWireUnmarshaller::readInt32 as BinaryWireUnmarshaller.() -> Any - is FieldDescriptor.Type.Primitive.Fixed64 -> BinaryWireUnmarshaller::readFixed64 as BinaryWireUnmarshaller.() -> Any - is FieldDescriptor.Type.Primitive.Fixed32 -> BinaryWireUnmarshaller::readFixed32 as BinaryWireUnmarshaller.() -> Any - is FieldDescriptor.Type.Primitive.Bool -> BinaryWireUnmarshaller::readBool as BinaryWireUnmarshaller.() -> Any - is FieldDescriptor.Type.Primitive.String -> BinaryWireUnmarshaller::readString as BinaryWireUnmarshaller.() -> Any - is FieldDescriptor.Type.Primitive.Bytes -> BinaryWireUnmarshaller::readBytes as BinaryWireUnmarshaller.() -> Any - is FieldDescriptor.Type.Primitive.UInt32 -> BinaryWireUnmarshaller::readUInt32 as BinaryWireUnmarshaller.() -> Any - is FieldDescriptor.Type.Primitive.SFixed32 -> BinaryWireUnmarshaller::readSFixed32 as BinaryWireUnmarshaller.() -> Any - is FieldDescriptor.Type.Primitive.SFixed64 -> BinaryWireUnmarshaller::readSFixed64 as BinaryWireUnmarshaller.() -> Any - is FieldDescriptor.Type.Primitive.SInt32 -> BinaryWireUnmarshaller::readSInt32 as BinaryWireUnmarshaller.() -> Any - is FieldDescriptor.Type.Primitive.SInt64 -> BinaryWireUnmarshaller::readSInt64 as BinaryWireUnmarshaller.() -> Any + is FieldDescriptor.Type.Primitive.Double -> BinaryWireDecoder::readDouble as BinaryWireDecoder.() -> Any + is FieldDescriptor.Type.Primitive.Float -> BinaryWireDecoder::readFloat as BinaryWireDecoder.() -> Any + is FieldDescriptor.Type.Primitive.Int64 -> BinaryWireDecoder::readInt64 as BinaryWireDecoder.() -> Any + is FieldDescriptor.Type.Primitive.UInt64 -> BinaryWireDecoder::readUInt64 as BinaryWireDecoder.() -> Any + is FieldDescriptor.Type.Primitive.Int32 -> BinaryWireDecoder::readInt32 as BinaryWireDecoder.() -> Any + is FieldDescriptor.Type.Primitive.Fixed64 -> BinaryWireDecoder::readFixed64 as BinaryWireDecoder.() -> Any + is FieldDescriptor.Type.Primitive.Fixed32 -> BinaryWireDecoder::readFixed32 as BinaryWireDecoder.() -> Any + is FieldDescriptor.Type.Primitive.Bool -> BinaryWireDecoder::readBool as BinaryWireDecoder.() -> Any + is FieldDescriptor.Type.Primitive.String -> BinaryWireDecoder::readString as BinaryWireDecoder.() -> Any + is FieldDescriptor.Type.Primitive.Bytes -> BinaryWireDecoder::readBytes as BinaryWireDecoder.() -> Any + is FieldDescriptor.Type.Primitive.UInt32 -> BinaryWireDecoder::readUInt32 as BinaryWireDecoder.() -> Any + is FieldDescriptor.Type.Primitive.SFixed32 -> BinaryWireDecoder::readSFixed32 as BinaryWireDecoder.() -> Any + is FieldDescriptor.Type.Primitive.SFixed64 -> BinaryWireDecoder::readSFixed64 as BinaryWireDecoder.() -> Any + is FieldDescriptor.Type.Primitive.SInt32 -> BinaryWireDecoder::readSInt32 as BinaryWireDecoder.() -> Any + is FieldDescriptor.Type.Primitive.SInt64 -> BinaryWireDecoder::readSInt64 as BinaryWireDecoder.() -> Any is FieldDescriptor.Type.Message<*> -> when (messageCompanion) { - DoubleValue.Companion -> fun BinaryWireUnmarshaller.(): Any = + DoubleValue.Companion -> fun BinaryWireDecoder.(): Any = (readMessage(this@binaryReadFn.messageCompanion) as DoubleValue).value - FloatValue.Companion -> fun BinaryWireUnmarshaller.(): Any = + FloatValue.Companion -> fun BinaryWireDecoder.(): Any = (readMessage(this@binaryReadFn.messageCompanion) as FloatValue).value - Int64Value.Companion -> fun BinaryWireUnmarshaller.(): Any = + Int64Value.Companion -> fun BinaryWireDecoder.(): Any = (readMessage(this@binaryReadFn.messageCompanion) as Int64Value).value - UInt64Value.Companion -> fun BinaryWireUnmarshaller.(): Any = + UInt64Value.Companion -> fun BinaryWireDecoder.(): Any = (readMessage(this@binaryReadFn.messageCompanion) as UInt64Value).value - Int32Value.Companion -> fun BinaryWireUnmarshaller.(): Any = + Int32Value.Companion -> fun BinaryWireDecoder.(): Any = (readMessage(this@binaryReadFn.messageCompanion) as Int32Value).value - UInt32Value.Companion -> fun BinaryWireUnmarshaller.(): Any = + UInt32Value.Companion -> fun BinaryWireDecoder.(): Any = (readMessage(this@binaryReadFn.messageCompanion) as UInt32Value).value - BoolValue.Companion -> fun BinaryWireUnmarshaller.(): Any = + BoolValue.Companion -> fun BinaryWireDecoder.(): Any = (readMessage(this@binaryReadFn.messageCompanion) as BoolValue).value - StringValue.Companion -> fun BinaryWireUnmarshaller.(): Any = + StringValue.Companion -> fun BinaryWireDecoder.(): Any = (readMessage(this@binaryReadFn.messageCompanion) as StringValue).value - BytesValue.Companion -> fun BinaryWireUnmarshaller.(): Any = + BytesValue.Companion -> fun BinaryWireDecoder.(): Any = (readMessage(this@binaryReadFn.messageCompanion) as BytesValue).value - else -> fun BinaryWireUnmarshaller.(): Any = readMessage(this@binaryReadFn.messageCompanion) + else -> fun BinaryWireDecoder.(): Any = readMessage(this@binaryReadFn.messageCompanion) } - is FieldDescriptor.Type.Enum<*> -> fun BinaryWireUnmarshaller.(): Any = + is FieldDescriptor.Type.Enum<*> -> fun BinaryWireDecoder.(): Any = readEnum(this@binaryReadFn.enumCompanion) is FieldDescriptor.Type.Repeated<*> -> error("Repeated values should've been handled by the caller of this method") - is FieldDescriptor.Type.Map<*, *> -> fun BinaryWireUnmarshaller.(): Any = + is FieldDescriptor.Type.Map<*, *> -> fun BinaryWireDecoder.(): Any = sequenceOf(readMessage(this@binaryReadFn.entryCompanion)) } } -internal class BinaryMessageUnmarshaller(private val wireUnmarshaller: BinaryWireUnmarshaller) : MessageUnmarshaller { +internal class BinaryMessageDecoder(private val wireDecoder: BinaryWireDecoder) : MessageDecoder { @Suppress("UNCHECKED_CAST") override fun readMessage( @@ -93,7 +93,7 @@ internal class BinaryMessageUnmarshaller(private val wireUnmarshaller: BinaryWir val unknownFields = mutableMapOf() val fieldDescriptors = messageCompanion.descriptor.fields.associateBy { it.number } while (true) { - val tag = wireUnmarshaller.readTag() + val tag = wireDecoder.readTag() if (tag == Tag(0)) break val fieldNum = tag.fieldNumber val wireType = tag.wireType @@ -104,7 +104,7 @@ internal class BinaryMessageUnmarshaller(private val wireUnmarshaller: BinaryWir val value = if (fd.type is FieldDescriptor.Type.Repeated<*>) { readRepeated(fd.type, wireType) } else { - fd.type.binaryReadFn(wireUnmarshaller) + fd.type.binaryReadFn(wireDecoder) } fieldFn(fieldNum, value) } @@ -117,7 +117,7 @@ internal class BinaryMessageUnmarshaller(private val wireUnmarshaller: BinaryWir } private fun addUnknownField(fieldNum: Int, wireType: WireType, unknownFields: MutableMap) { - val unknownField = wireUnmarshaller.readUnknownField(fieldNum, wireType) ?: return + val unknownField = wireDecoder.readUnknownField(fieldNum, wireType) ?: return unknownFields[fieldNum] = UnknownField(fieldNum, unknownFields[fieldNum]?.let { prevField -> if (prevField.value is UnknownField.Value.Composite) { // TODO: make parsing of repeated unknown fields more efficient by not creating a copy of the list with @@ -130,15 +130,15 @@ internal class BinaryMessageUnmarshaller(private val wireUnmarshaller: BinaryWir } private fun readRepeated(type: FieldDescriptor.Type.Repeated<*>, wireType: WireType): Any { - val valueUnmarshaller = type.valueType.binaryReadFn + val valueDecoder = type.valueType.binaryReadFn return if (wireType == WireType.LENGTH_DELIMITED && type.valueType.isPackable) { - wireUnmarshaller.readPackedRepeated(valueUnmarshaller) + wireDecoder.readPackedRepeated(valueDecoder) } else { - sequenceOf(valueUnmarshaller(wireUnmarshaller)) + sequenceOf(valueDecoder(wireDecoder)) } } companion object } -internal expect fun BinaryMessageUnmarshaller.Companion.fromByteArray(arr: ByteArray): MessageUnmarshaller +internal expect fun BinaryMessageDecoder.Companion.fromByteArray(arr: ByteArray): MessageDecoder diff --git a/runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryMessageMarshaller.kt b/runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryMessageEncoder.kt similarity index 77% rename from runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryMessageMarshaller.kt rename to runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryMessageEncoder.kt index d6dee382..88a47875 100644 --- a/runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryMessageMarshaller.kt +++ b/runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryMessageEncoder.kt @@ -5,7 +5,7 @@ import pbandk.wkt.* import kotlin.Any import kotlin.reflect.KProperty1 -internal open class BinaryMessageMarshaller(private val wireMarshaller: BinaryWireMarshaller) : MessageMarshaller { +internal open class BinaryMessageEncoder(private val wireEncoder: BinaryWireEncoder) : MessageEncoder { override fun writeMessage(message: T) { for (fd in message.descriptor.fields) { @Suppress("UNCHECKED_CAST") @@ -25,7 +25,7 @@ internal open class BinaryMessageMarshaller(private val wireMarshaller: BinaryWi private fun writeFieldValue(fieldNum: Int, type: FieldDescriptor.Type, value: Any) { when (type) { - is FieldDescriptor.Type.Primitive<*> -> wireMarshaller.writePrimitiveValue(fieldNum, type, value) + is FieldDescriptor.Type.Primitive<*> -> wireEncoder.writePrimitiveValue(fieldNum, type, value) is FieldDescriptor.Type.Message<*> -> when (type.messageCompanion) { DoubleValue.Companion -> writeWrapperValue(fieldNum, type, value as Double, Sizer::doubleSize) @@ -39,7 +39,7 @@ internal open class BinaryMessageMarshaller(private val wireMarshaller: BinaryWi BytesValue.Companion -> writeWrapperValue(fieldNum, type, value as ByteArr, Sizer::bytesSize) else -> writeMessageValue(fieldNum, value as Message) } - is FieldDescriptor.Type.Enum<*> -> wireMarshaller.writeEnum(fieldNum, value as Message.Enum) + is FieldDescriptor.Type.Enum<*> -> wireEncoder.writeEnum(fieldNum, value as Message.Enum) is FieldDescriptor.Type.Repeated<*> -> writeRepeatedValue( fieldNum, @@ -60,21 +60,21 @@ internal open class BinaryMessageMarshaller(private val wireMarshaller: BinaryWi ) { val valueType = type.messageCompanion.descriptor.fields.first().type if (valueType.isDefaultValue(value)) { - wireMarshaller.writeLengthDelimitedHeader(fieldNum, 0) + wireEncoder.writeLengthDelimitedHeader(fieldNum, 0) } else { - wireMarshaller.writeLengthDelimitedHeader(fieldNum, Sizer.tagSize(1) + sizeFn(value)) + wireEncoder.writeLengthDelimitedHeader(fieldNum, Sizer.tagSize(1) + sizeFn(value)) writeFieldValue(1, valueType, value) } } private fun writeMessageValue(fieldNum: Int, message: Message) { - wireMarshaller.writeLengthDelimitedHeader(fieldNum, message.protoSize) + wireEncoder.writeLengthDelimitedHeader(fieldNum, message.protoSize) writeMessage(message) } private fun writeRepeatedValue(fieldNum: Int, list: List<*>, valueType: FieldDescriptor.Type, packed: Boolean) { if (packed) { - wireMarshaller.writePackedRepeated(fieldNum, list, valueType) + wireEncoder.writePackedRepeated(fieldNum, list, valueType) } else { list.forEach { writeFieldValue(fieldNum, valueType, checkNotNull(it)) @@ -100,12 +100,12 @@ internal open class BinaryMessageMarshaller(private val wireMarshaller: BinaryWi private fun writeUnknownFieldValue(fieldNum: Int, value: UnknownField.Value) { when (value) { - is UnknownField.Value.Varint -> wireMarshaller.writeUInt64(fieldNum, value.varint) - is UnknownField.Value.Fixed64 -> wireMarshaller.writeFixed64(fieldNum, value.fixed64) - is UnknownField.Value.LengthDelimited -> wireMarshaller.writeBytes(fieldNum, value.bytes) + is UnknownField.Value.Varint -> wireEncoder.writeUInt64(fieldNum, value.varint) + is UnknownField.Value.Fixed64 -> wireEncoder.writeFixed64(fieldNum, value.fixed64) + is UnknownField.Value.LengthDelimited -> wireEncoder.writeBytes(fieldNum, value.bytes) UnknownField.Value.StartGroup -> throw UnsupportedOperationException() UnknownField.Value.EndGroup -> throw UnsupportedOperationException() - is UnknownField.Value.Fixed32 -> wireMarshaller.writeFixed32(fieldNum, value.fixed32) + is UnknownField.Value.Fixed32 -> wireEncoder.writeFixed32(fieldNum, value.fixed32) is UnknownField.Value.Composite -> value.values.forEach { writeUnknownFieldValue(fieldNum, it) } } } @@ -113,8 +113,8 @@ internal open class BinaryMessageMarshaller(private val wireMarshaller: BinaryWi companion object } -internal expect fun BinaryMessageMarshaller.Companion.allocate(size: Int): ByteArrayMessageMarshaller +internal expect fun BinaryMessageEncoder.Companion.allocate(size: Int): ByteArrayMessageEncoder -internal interface ByteArrayMessageMarshaller : MessageMarshaller { +internal interface ByteArrayMessageEncoder : MessageEncoder { fun toByteArray(): ByteArray } diff --git a/runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryWireUnmarshaller.kt b/runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryWireDecoder.kt similarity index 86% rename from runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryWireUnmarshaller.kt rename to runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryWireDecoder.kt index 8aaada56..91f66a42 100644 --- a/runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryWireUnmarshaller.kt +++ b/runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryWireDecoder.kt @@ -4,7 +4,7 @@ import pbandk.ByteArr import pbandk.Message import pbandk.UnknownField -internal interface BinaryWireUnmarshaller { +internal interface BinaryWireDecoder { /** Returns 0 when there is no next tag (e.g. at EOF) */ fun readTag(): Tag @@ -25,7 +25,7 @@ internal interface BinaryWireUnmarshaller { fun readBytes(): ByteArr fun readEnum(enumCompanion: Message.Enum.Companion): T fun readMessage(messageCompanion: Message.Companion): T - fun readPackedRepeated(readFn: BinaryWireUnmarshaller.() -> T): Sequence + fun readPackedRepeated(readFn: BinaryWireDecoder.() -> T): Sequence fun readUnknownField(fieldNum: Int, wireType: WireType): UnknownField.Value? } \ No newline at end of file diff --git a/runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryWireMarshaller.kt b/runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryWireEncoder.kt similarity index 96% rename from runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryWireMarshaller.kt rename to runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryWireEncoder.kt index bc9888e9..73fc0c46 100644 --- a/runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryWireMarshaller.kt +++ b/runtime/src/commonMain/kotlin/pbandk/internal/binary/BinaryWireEncoder.kt @@ -4,7 +4,7 @@ import pbandk.ByteArr import pbandk.FieldDescriptor import pbandk.Message -internal interface BinaryWireMarshaller { +internal interface BinaryWireEncoder { fun writeLengthDelimitedHeader(fieldNum: Int, protoSize: Int) fun writePackedRepeated(fieldNum: Int, list: List<*>, valueType: FieldDescriptor.Type) @@ -42,7 +42,7 @@ internal interface BinaryWireMarshaller { fun writeBytes(fieldNum: Int, value: ByteArr) } -internal fun BinaryWireMarshaller.writePrimitiveValue( +internal fun BinaryWireEncoder.writePrimitiveValue( fieldNum: Int, type: FieldDescriptor.Type.Primitive<*>, value: Any diff --git a/runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryMessageEncoder.kt b/runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryMessageEncoder.kt new file mode 100644 index 00000000..11451c3a --- /dev/null +++ b/runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryMessageEncoder.kt @@ -0,0 +1,14 @@ +package pbandk.internal.binary.kotlin + +import pbandk.internal.binary.BinaryMessageEncoder +import pbandk.internal.binary.ByteArrayMessageEncoder + +internal class KotlinBinaryMessageEncoder private constructor( + private val writer: ByteArrayWireWriter +) : BinaryMessageEncoder(KotlinBinaryWireEncoder(writer)), ByteArrayMessageEncoder { + override fun toByteArray() = writer.toByteArray() + + companion object { + fun allocate(size: Int) = KotlinBinaryMessageEncoder(ByteArrayWireWriter.allocate(size)) + } +} \ No newline at end of file diff --git a/runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryMessageMarshaller.kt b/runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryMessageMarshaller.kt deleted file mode 100644 index db4644b5..00000000 --- a/runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryMessageMarshaller.kt +++ /dev/null @@ -1,14 +0,0 @@ -package pbandk.internal.binary.kotlin - -import pbandk.internal.binary.BinaryMessageMarshaller -import pbandk.internal.binary.ByteArrayMessageMarshaller - -internal class KotlinBinaryMessageMarshaller private constructor( - private val writer: ByteArrayWireWriter -) : BinaryMessageMarshaller(KotlinBinaryWireMarshaller(writer)), ByteArrayMessageMarshaller { - override fun toByteArray() = writer.toByteArray() - - companion object { - fun allocate(size: Int) = KotlinBinaryMessageMarshaller(ByteArrayWireWriter.allocate(size)) - } -} \ No newline at end of file diff --git a/runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryWireUnmarshaller.kt b/runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryWireDecoder.kt similarity index 96% rename from runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryWireUnmarshaller.kt rename to runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryWireDecoder.kt index c50d5747..abc32cba 100644 --- a/runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryWireUnmarshaller.kt +++ b/runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryWireDecoder.kt @@ -32,12 +32,12 @@ package pbandk.internal.binary.kotlin import pbandk.* import pbandk.internal.Util import pbandk.internal.binary.* -import pbandk.internal.binary.BinaryMessageUnmarshaller -import pbandk.internal.binary.BinaryWireUnmarshaller +import pbandk.internal.binary.BinaryMessageDecoder +import pbandk.internal.binary.BinaryWireDecoder import pbandk.internal.binary.Tag import pbandk.internal.binary.WireType -internal class KotlinBinaryWireUnmarshaller(private val wireReader: WireReader) : BinaryWireUnmarshaller { +internal class KotlinBinaryWireDecoder(private val wireReader: WireReader) : BinaryWireDecoder { private var lastTag: Tag = Tag(0) private var consumed: Int = 0 private var curLimit: Int? = null @@ -211,7 +211,7 @@ internal class KotlinBinaryWireUnmarshaller(private val wireReader: WireReader) override fun readMessage(messageCompanion: Message.Companion): T { val oldLimit = pushLimit(readRawVarint32()) - val message = messageCompanion.unmarshal(BinaryMessageUnmarshaller(this)) + val message = messageCompanion.decodeWith(BinaryMessageDecoder(this)) if (!isAtEnd()) { throw InvalidProtocolBufferException("Not at the end of the current message limit as expected") } @@ -219,7 +219,7 @@ internal class KotlinBinaryWireUnmarshaller(private val wireReader: WireReader) return message } - override fun readPackedRepeated(readFn: BinaryWireUnmarshaller.() -> T): Sequence { + override fun readPackedRepeated(readFn: BinaryWireDecoder.() -> T): Sequence { return sequence { val oldLimit = pushLimit(readRawVarint32()) while (!isAtEnd()) yield(readFn()) @@ -228,7 +228,7 @@ internal class KotlinBinaryWireUnmarshaller(private val wireReader: WireReader) } override fun readUnknownField(fieldNum: Int, wireType: WireType): UnknownField.Value? { - // TODO: support a `discardUnknownFields` option in the BinaryMessageUnmarshaller + // TODO: support a `discardUnknownFields` option in the BinaryMessageDecoder //val unknownFields = currentUnknownFields ?: return run { stream.skipField(tag) } return when (wireType) { WireType.VARINT -> UnknownField.Value.Varint(readInt64()) diff --git a/runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryWireMarshaller.kt b/runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryWireEncoder.kt similarity index 98% rename from runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryWireMarshaller.kt rename to runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryWireEncoder.kt index a6f9abaf..50a668eb 100644 --- a/runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryWireMarshaller.kt +++ b/runtime/src/commonMain/kotlin/pbandk/internal/binary/kotlin/KotlinBinaryWireEncoder.kt @@ -32,12 +32,12 @@ package pbandk.internal.binary.kotlin import pbandk.* import pbandk.internal.Util import pbandk.internal.binary.* -import pbandk.internal.binary.BinaryWireMarshaller +import pbandk.internal.binary.BinaryWireEncoder import pbandk.internal.binary.WireType import pbandk.internal.binary.protoSize import pbandk.internal.binary.zigZagEncoded -internal class KotlinBinaryWireMarshaller(private val wireWriter: WireWriter) : BinaryWireMarshaller { +internal class KotlinBinaryWireEncoder(private val wireWriter: WireWriter) : BinaryWireEncoder { private fun writeValueNoTag(type: FieldDescriptor.Type, value: Any) { when (type) { is FieldDescriptor.Type.Primitive.Double -> writeDoubleNoTag(value as Double) diff --git a/runtime/src/commonMain/kotlin/pbandk/internal/json/JsonMessageUnmarshaller.kt b/runtime/src/commonMain/kotlin/pbandk/internal/json/JsonMessageDecoder.kt similarity index 84% rename from runtime/src/commonMain/kotlin/pbandk/internal/json/JsonMessageUnmarshaller.kt rename to runtime/src/commonMain/kotlin/pbandk/internal/json/JsonMessageDecoder.kt index f5d4f04d..30e226ba 100644 --- a/runtime/src/commonMain/kotlin/pbandk/internal/json/JsonMessageUnmarshaller.kt +++ b/runtime/src/commonMain/kotlin/pbandk/internal/json/JsonMessageDecoder.kt @@ -16,10 +16,11 @@ private val FieldDescriptor<*, *>.jsonNames: List name ) -internal class JsonMessageUnmarshaller internal constructor( - private val content: JsonElement, private val jsonConfig: JsonConfig -) : MessageUnmarshaller { - private val jsonValueUnmarshaller = JsonValueUnmarshaller(jsonConfig) +internal class JsonMessageDecoder internal constructor( + private val content: JsonElement, + private val jsonConfig: JsonConfig +) : MessageDecoder { + private val jsonValueDecoder = JsonValueDecoder(jsonConfig) override fun readMessage( messageCompanion: Message.Companion, @@ -58,16 +59,16 @@ internal class JsonMessageUnmarshaller internal constructor( fieldFn(fd.number, defaultValue) } } else { - fieldFn(fd.number, jsonValueUnmarshaller.readValue(jsonValue, fd.type)) + fieldFn(fd.number, jsonValueDecoder.readValue(jsonValue, fd.type)) } } } companion object { - fun fromString(data: String, jsonConfig: JsonConfig = JsonConfig.DEFAULT): JsonMessageUnmarshaller { + fun fromString(data: String, jsonConfig: JsonConfig = JsonConfig.DEFAULT): JsonMessageDecoder { val json = Json(JsonConfiguration.Stable) val content = json.parse(JsonElementSerializer, data) - return JsonMessageUnmarshaller(content, jsonConfig) + return JsonMessageDecoder(content, jsonConfig) } } } diff --git a/runtime/src/commonMain/kotlin/pbandk/internal/json/JsonMessageMarshaller.kt b/runtime/src/commonMain/kotlin/pbandk/internal/json/JsonMessageEncoder.kt similarity index 74% rename from runtime/src/commonMain/kotlin/pbandk/internal/json/JsonMessageMarshaller.kt rename to runtime/src/commonMain/kotlin/pbandk/internal/json/JsonMessageEncoder.kt index 6c58841d..80be4b19 100644 --- a/runtime/src/commonMain/kotlin/pbandk/internal/json/JsonMessageMarshaller.kt +++ b/runtime/src/commonMain/kotlin/pbandk/internal/json/JsonMessageEncoder.kt @@ -8,13 +8,13 @@ import pbandk.wkt.* import kotlin.Any import kotlin.reflect.KProperty1 -internal class JsonMessageMarshaller(private val jsonConfig: JsonConfig) : MessageMarshaller { +internal class JsonMessageEncoder(private val jsonConfig: JsonConfig) : MessageEncoder { private val json = Json( JsonConfiguration.Stable.copy( prettyPrint = true ) ) - private val jsonValueMarshaller = JsonValueMarshaller(jsonConfig) + private val jsonValueEncoder = JsonValueEncoder(jsonConfig) private var currentMessage: JsonElement? = null fun toJsonString(): String = currentMessage?.let { json.stringify(JsonElementSerializer, it) }.orEmpty() @@ -23,7 +23,7 @@ internal class JsonMessageMarshaller(private val jsonConfig: JsonConfig) : Messa currentMessage ?: error("Must call writeMessage() before toJsonElement()") override fun writeMessage(message: T) { - check(currentMessage == null) { "JsonWireMarshaller can't be reused with multiple messages" } + check(currentMessage == null) { "JsonMessageEncoder can't be reused with multiple messages" } currentMessage = when (message) { // Wrapper types use the same JSON representation as the wrapped value // https://developers.google.com/protocol-buffers/docs/proto3#json @@ -37,17 +37,17 @@ internal class JsonMessageMarshaller(private val jsonConfig: JsonConfig) : Messa is StringValue -> writeWrapperValue(message, message.value) is BytesValue -> writeWrapperValue(message, message.value) // Other well-known types with special JSON encoding - is Timestamp -> jsonValueMarshaller.writeString(Util.timestampToString(message)) - is Struct -> jsonValueMarshaller.writeValue(message.fields, message.descriptor.fields.first().type) - is ListValue -> jsonValueMarshaller.writeRepeated(message.values, FieldDescriptor.Type.Message(Value.Companion)) - is Value -> jsonValueMarshaller.writeDynamicValue(message) + is Timestamp -> jsonValueEncoder.writeString(Util.timestampToString(message)) + is Struct -> jsonValueEncoder.writeValue(message.fields, message.descriptor.fields.first().type) + is ListValue -> jsonValueEncoder.writeRepeated(message.values, FieldDescriptor.Type.Message(Value.Companion)) + is Value -> jsonValueEncoder.writeDynamicValue(message) // All other message types else -> writeMessageObject(message) } } private fun writeWrapperValue(message: Message, value: Any) = - jsonValueMarshaller.writeValue(value, message.descriptor.fields.first().type) + jsonValueEncoder.writeValue(value, message.descriptor.fields.first().type) private fun writeMessageObject(message: T): JsonObject { val jsonContent: MutableMap = linkedMapOf() @@ -59,7 +59,7 @@ internal class JsonMessageMarshaller(private val jsonConfig: JsonConfig) : Messa if (value == null && fd.oneofMember) continue if (!fd.oneofMember && !jsonConfig.outputDefaultValues && fd.type.isDefaultValue(value)) continue - val jsonValue = value?.let { jsonValueMarshaller.writeValue(it, fd.type) } ?: JsonNull + val jsonValue = value?.let { jsonValueEncoder.writeValue(it, fd.type) } ?: JsonNull jsonContent[jsonConfig.getFieldJsonName(fd)] = jsonValue } diff --git a/runtime/src/commonMain/kotlin/pbandk/internal/json/JsonValueUnmarshaller.kt b/runtime/src/commonMain/kotlin/pbandk/internal/json/JsonValueDecoder.kt similarity index 98% rename from runtime/src/commonMain/kotlin/pbandk/internal/json/JsonValueUnmarshaller.kt rename to runtime/src/commonMain/kotlin/pbandk/internal/json/JsonValueDecoder.kt index cf297b07..98768858 100644 --- a/runtime/src/commonMain/kotlin/pbandk/internal/json/JsonValueUnmarshaller.kt +++ b/runtime/src/commonMain/kotlin/pbandk/internal/json/JsonValueDecoder.kt @@ -8,7 +8,7 @@ import pbandk.wkt.* import kotlin.Any @OptIn(ExperimentalUnsignedTypes::class) -internal class JsonValueUnmarshaller(private val jsonConfig: JsonConfig) { +internal class JsonValueDecoder(private val jsonConfig: JsonConfig) { fun readValue(value: JsonElement, type: FieldDescriptor.Type, isMapKey: Boolean = false): Any = when (type) { is FieldDescriptor.Type.Primitive.Double -> readDouble(value) is FieldDescriptor.Type.Primitive.Float -> readFloat(value) @@ -134,7 +134,7 @@ internal class JsonValueUnmarshaller(private val jsonConfig: JsonConfig) { } fun readMessage(value: JsonElement, messageCompanion: Message.Companion<*>): Message = try { - messageCompanion.unmarshal(JsonMessageUnmarshaller(value, jsonConfig)) + messageCompanion.decodeWith(JsonMessageDecoder(value, jsonConfig)) } catch (e: InvalidProtocolBufferException) { throw e } catch (e: Exception) { diff --git a/runtime/src/commonMain/kotlin/pbandk/internal/json/JsonValueMarshaller.kt b/runtime/src/commonMain/kotlin/pbandk/internal/json/JsonValueEncoder.kt similarity index 94% rename from runtime/src/commonMain/kotlin/pbandk/internal/json/JsonValueMarshaller.kt rename to runtime/src/commonMain/kotlin/pbandk/internal/json/JsonValueEncoder.kt index f907082c..c5c10d9f 100644 --- a/runtime/src/commonMain/kotlin/pbandk/internal/json/JsonValueMarshaller.kt +++ b/runtime/src/commonMain/kotlin/pbandk/internal/json/JsonValueEncoder.kt @@ -10,7 +10,7 @@ import pbandk.wkt.* import kotlin.Any @OptIn(ExperimentalUnsignedTypes::class) -internal class JsonValueMarshaller(private val jsonConfig: JsonConfig) { +internal class JsonValueEncoder(private val jsonConfig: JsonConfig) { fun writeValue(value: Any, type: FieldDescriptor.Type): JsonElement = when (type) { is FieldDescriptor.Type.Primitive.Double -> writeDouble(value as Double) is FieldDescriptor.Type.Primitive.Float -> writeFloat(value as Float) @@ -32,8 +32,8 @@ internal class JsonValueMarshaller(private val jsonConfig: JsonConfig) { // Kotlin. For example, the [DoubleValue] message is represented in Kotlin as a [Double] type. All other // messages, those have a special JSON encoding but are represented in Kotlin using their normal [Message] // type (e.g. the [Timestamp] message), only need to be special-cased in - // [JsonMessageMarshaller.writeMessage]. The `else` clause below will end up calling the code in - // [JsonMessageMarshaller.writeMessage]. + // [JsonMessageEncoder.writeMessage]. The `else` clause below will end up calling the code in + // [JsonMessageEncoder.writeMessage]. DoubleValue -> writeDouble(value as Double) FloatValue -> writeFloat(value as Float) Int64Value -> writeInteger64(value as Long) @@ -95,7 +95,7 @@ internal class JsonValueMarshaller(private val jsonConfig: JsonConfig) { JsonLiteral(Util.bytesToBase64(value.array)) fun writeMessage(value: Message): JsonElement = - JsonMessageMarshaller(jsonConfig).also { it.writeMessage(value) }.toJsonElement() + JsonMessageEncoder(jsonConfig).also { it.writeMessage(value) }.toJsonElement() fun writeRepeated(list: List<*>, valueType: FieldDescriptor.Type): JsonElement = jsonArray { diff --git a/runtime/src/commonMain/kotlin/pbandk/json/MessageExtensions.kt b/runtime/src/commonMain/kotlin/pbandk/json/MessageExtensions.kt index 29d41abf..89038a02 100644 --- a/runtime/src/commonMain/kotlin/pbandk/json/MessageExtensions.kt +++ b/runtime/src/commonMain/kotlin/pbandk/json/MessageExtensions.kt @@ -2,13 +2,15 @@ package pbandk.json import pbandk.ExperimentalProtoJson import pbandk.Message -import pbandk.internal.json.JsonMessageMarshaller -import pbandk.internal.json.JsonMessageUnmarshaller +import pbandk.internal.json.JsonMessageEncoder +import pbandk.internal.json.JsonMessageDecoder @ExperimentalProtoJson -fun T.jsonMarshal(jsonConfig: JsonConfig = JsonConfig.DEFAULT) = - JsonMessageMarshaller(jsonConfig).also{ it.writeMessage(this) }.toJsonString() +fun T.encodeToJsonString(jsonConfig: JsonConfig = JsonConfig.DEFAULT): String = + JsonMessageEncoder(jsonConfig).also { it.writeMessage(this) }.toJsonString() @ExperimentalProtoJson -fun Message.Companion.jsonUnmarshal(data: String, jsonConfig: JsonConfig = JsonConfig.DEFAULT): T = - unmarshal(JsonMessageUnmarshaller.fromString(data, jsonConfig)) \ No newline at end of file +fun Message.Companion.decodeFromJsonString( + data: String, + jsonConfig: JsonConfig = JsonConfig.DEFAULT +): T = decodeWith(JsonMessageDecoder.fromString(data, jsonConfig)) \ No newline at end of file diff --git a/runtime/src/commonMain/kotlin/pbandk/wkt/any.kt b/runtime/src/commonMain/kotlin/pbandk/wkt/any.kt index ac8f4e14..23294cdc 100644 --- a/runtime/src/commonMain/kotlin/pbandk/wkt/any.kt +++ b/runtime/src/commonMain/kotlin/pbandk/wkt/any.kt @@ -12,7 +12,7 @@ data class Any( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { Any() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = Any.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = Any.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -48,7 +48,7 @@ private fun Any.protoMergeImpl(plus: pbandk.Message?): Any = (plus as? Any)?.cop ) ?: this @Suppress("UNCHECKED_CAST") -private fun Any.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): Any { +private fun Any.Companion.decodeWithImpl(u: pbandk.MessageDecoder): Any { var typeUrl = "" var value: pbandk.ByteArr = pbandk.ByteArr.empty diff --git a/runtime/src/commonMain/kotlin/pbandk/wkt/api.kt b/runtime/src/commonMain/kotlin/pbandk/wkt/api.kt index 32a66cba..b912bc1e 100644 --- a/runtime/src/commonMain/kotlin/pbandk/wkt/api.kt +++ b/runtime/src/commonMain/kotlin/pbandk/wkt/api.kt @@ -17,7 +17,7 @@ data class Api( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { Api() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = Api.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = Api.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -101,7 +101,7 @@ data class Method( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { Method() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = Method.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = Method.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -180,7 +180,7 @@ data class Mixin( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { Mixin() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = Mixin.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = Mixin.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -220,7 +220,7 @@ private fun Api.protoMergeImpl(plus: pbandk.Message?): Api = (plus as? Api)?.cop ) ?: this @Suppress("UNCHECKED_CAST") -private fun Api.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): Api { +private fun Api.Companion.decodeWithImpl(u: pbandk.MessageDecoder): Api { var name = "" var methods: pbandk.ListWithSize.Builder? = null var options: pbandk.ListWithSize.Builder? = null @@ -252,7 +252,7 @@ private fun Method.protoMergeImpl(plus: pbandk.Message?): Method = (plus as? Met ) ?: this @Suppress("UNCHECKED_CAST") -private fun Method.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): Method { +private fun Method.Companion.decodeWithImpl(u: pbandk.MessageDecoder): Method { var name = "" var requestTypeUrl = "" var requestStreaming = false @@ -283,7 +283,7 @@ private fun Mixin.protoMergeImpl(plus: pbandk.Message?): Mixin = (plus as? Mixin ) ?: this @Suppress("UNCHECKED_CAST") -private fun Mixin.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): Mixin { +private fun Mixin.Companion.decodeWithImpl(u: pbandk.MessageDecoder): Mixin { var name = "" var root = "" diff --git a/runtime/src/commonMain/kotlin/pbandk/wkt/descriptor.kt b/runtime/src/commonMain/kotlin/pbandk/wkt/descriptor.kt index 01313b49..eca95c0e 100644 --- a/runtime/src/commonMain/kotlin/pbandk/wkt/descriptor.kt +++ b/runtime/src/commonMain/kotlin/pbandk/wkt/descriptor.kt @@ -11,7 +11,7 @@ data class FileDescriptorSet( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { FileDescriptorSet() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = FileDescriptorSet.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = FileDescriptorSet.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -52,7 +52,7 @@ data class FileDescriptorProto( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { FileDescriptorProto() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = FileDescriptorProto.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = FileDescriptorProto.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -179,7 +179,7 @@ data class DescriptorProto( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { DescriptorProto() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = DescriptorProto.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = DescriptorProto.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -282,7 +282,7 @@ data class DescriptorProto( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { DescriptorProto.ExtensionRange() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = DescriptorProto.ExtensionRange.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = DescriptorProto.ExtensionRange.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -329,7 +329,7 @@ data class DescriptorProto( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { DescriptorProto.ReservedRange() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = DescriptorProto.ReservedRange.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = DescriptorProto.ReservedRange.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -368,7 +368,7 @@ data class ExtensionRangeOptions( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { ExtensionRangeOptions() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = ExtensionRangeOptions.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = ExtensionRangeOptions.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -407,7 +407,7 @@ data class FieldDescriptorProto( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { FieldDescriptorProto() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = FieldDescriptorProto.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = FieldDescriptorProto.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -559,7 +559,7 @@ data class OneofDescriptorProto( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { OneofDescriptorProto() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = OneofDescriptorProto.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = OneofDescriptorProto.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -601,7 +601,7 @@ data class EnumDescriptorProto( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { EnumDescriptorProto() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = EnumDescriptorProto.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = EnumDescriptorProto.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -663,7 +663,7 @@ data class EnumDescriptorProto( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { EnumDescriptorProto.EnumReservedRange() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = EnumDescriptorProto.EnumReservedRange.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = EnumDescriptorProto.EnumReservedRange.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -704,7 +704,7 @@ data class EnumValueDescriptorProto( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { EnumValueDescriptorProto() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = EnumValueDescriptorProto.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = EnumValueDescriptorProto.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -752,7 +752,7 @@ data class ServiceDescriptorProto( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { ServiceDescriptorProto() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = ServiceDescriptorProto.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = ServiceDescriptorProto.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -803,7 +803,7 @@ data class MethodDescriptorProto( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { MethodDescriptorProto() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = MethodDescriptorProto.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = MethodDescriptorProto.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -893,7 +893,7 @@ data class FileOptions( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { FileOptions() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = FileOptions.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = FileOptions.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1104,7 +1104,7 @@ data class MessageOptions( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { MessageOptions() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = MessageOptions.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = MessageOptions.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1172,7 +1172,7 @@ data class FieldOptions( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { FieldOptions() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = FieldOptions.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = FieldOptions.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1284,7 +1284,7 @@ data class OneofOptions( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { OneofOptions() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = OneofOptions.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = OneofOptions.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1316,7 +1316,7 @@ data class EnumOptions( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { EnumOptions() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = EnumOptions.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = EnumOptions.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1363,7 +1363,7 @@ data class EnumValueOptions( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { EnumValueOptions() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = EnumValueOptions.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = EnumValueOptions.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1402,7 +1402,7 @@ data class ServiceOptions( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { ServiceOptions() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = ServiceOptions.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = ServiceOptions.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1442,7 +1442,7 @@ data class MethodOptions( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { MethodOptions() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = MethodOptions.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = MethodOptions.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1511,7 +1511,7 @@ data class UninterpretedOption( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { UninterpretedOption() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = UninterpretedOption.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = UninterpretedOption.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1589,7 +1589,7 @@ data class UninterpretedOption( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { UninterpretedOption.NamePart() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = UninterpretedOption.NamePart.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = UninterpretedOption.NamePart.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1628,7 +1628,7 @@ data class SourceCodeInfo( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { SourceCodeInfo() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = SourceCodeInfo.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = SourceCodeInfo.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1661,7 +1661,7 @@ data class SourceCodeInfo( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { SourceCodeInfo.Location() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = SourceCodeInfo.Location.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = SourceCodeInfo.Location.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1724,7 +1724,7 @@ data class GeneratedCodeInfo( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { GeneratedCodeInfo() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = GeneratedCodeInfo.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = GeneratedCodeInfo.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1756,7 +1756,7 @@ data class GeneratedCodeInfo( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { GeneratedCodeInfo.Annotation() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = GeneratedCodeInfo.Annotation.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = GeneratedCodeInfo.Annotation.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -1810,7 +1810,7 @@ private fun FileDescriptorSet.protoMergeImpl(plus: pbandk.Message?): FileDescrip ) ?: this @Suppress("UNCHECKED_CAST") -private fun FileDescriptorSet.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): FileDescriptorSet { +private fun FileDescriptorSet.Companion.decodeWithImpl(u: pbandk.MessageDecoder): FileDescriptorSet { var file: pbandk.ListWithSize.Builder? = null val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> @@ -1840,7 +1840,7 @@ private fun FileDescriptorProto.protoMergeImpl(plus: pbandk.Message?): FileDescr ) ?: this @Suppress("UNCHECKED_CAST") -private fun FileDescriptorProto.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): FileDescriptorProto { +private fun FileDescriptorProto.Companion.decodeWithImpl(u: pbandk.MessageDecoder): FileDescriptorProto { var name: String? = null var `package`: String? = null var dependency: pbandk.ListWithSize.Builder? = null @@ -1892,7 +1892,7 @@ private fun DescriptorProto.protoMergeImpl(plus: pbandk.Message?): DescriptorPro ) ?: this @Suppress("UNCHECKED_CAST") -private fun DescriptorProto.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): DescriptorProto { +private fun DescriptorProto.Companion.decodeWithImpl(u: pbandk.MessageDecoder): DescriptorProto { var name: String? = null var field: pbandk.ListWithSize.Builder? = null var extension: pbandk.ListWithSize.Builder? = null @@ -1933,7 +1933,7 @@ private fun DescriptorProto.ExtensionRange.protoMergeImpl(plus: pbandk.Message?) ) ?: this @Suppress("UNCHECKED_CAST") -private fun DescriptorProto.ExtensionRange.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): DescriptorProto.ExtensionRange { +private fun DescriptorProto.ExtensionRange.Companion.decodeWithImpl(u: pbandk.MessageDecoder): DescriptorProto.ExtensionRange { var start: Int? = null var end: Int? = null var options: pbandk.wkt.ExtensionRangeOptions? = null @@ -1957,7 +1957,7 @@ private fun DescriptorProto.ReservedRange.protoMergeImpl(plus: pbandk.Message?): ) ?: this @Suppress("UNCHECKED_CAST") -private fun DescriptorProto.ReservedRange.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): DescriptorProto.ReservedRange { +private fun DescriptorProto.ReservedRange.Companion.decodeWithImpl(u: pbandk.MessageDecoder): DescriptorProto.ReservedRange { var start: Int? = null var end: Int? = null @@ -1978,7 +1978,7 @@ private fun ExtensionRangeOptions.protoMergeImpl(plus: pbandk.Message?): Extensi ) ?: this @Suppress("UNCHECKED_CAST") -private fun ExtensionRangeOptions.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): ExtensionRangeOptions { +private fun ExtensionRangeOptions.Companion.decodeWithImpl(u: pbandk.MessageDecoder): ExtensionRangeOptions { var uninterpretedOption: pbandk.ListWithSize.Builder? = null val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> @@ -2006,7 +2006,7 @@ private fun FieldDescriptorProto.protoMergeImpl(plus: pbandk.Message?): FieldDes ) ?: this @Suppress("UNCHECKED_CAST") -private fun FieldDescriptorProto.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): FieldDescriptorProto { +private fun FieldDescriptorProto.Companion.decodeWithImpl(u: pbandk.MessageDecoder): FieldDescriptorProto { var name: String? = null var number: Int? = null var label: pbandk.wkt.FieldDescriptorProto.Label? = null @@ -2046,7 +2046,7 @@ private fun OneofDescriptorProto.protoMergeImpl(plus: pbandk.Message?): OneofDes ) ?: this @Suppress("UNCHECKED_CAST") -private fun OneofDescriptorProto.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): OneofDescriptorProto { +private fun OneofDescriptorProto.Companion.decodeWithImpl(u: pbandk.MessageDecoder): OneofDescriptorProto { var name: String? = null var options: pbandk.wkt.OneofOptions? = null @@ -2071,7 +2071,7 @@ private fun EnumDescriptorProto.protoMergeImpl(plus: pbandk.Message?): EnumDescr ) ?: this @Suppress("UNCHECKED_CAST") -private fun EnumDescriptorProto.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): EnumDescriptorProto { +private fun EnumDescriptorProto.Companion.decodeWithImpl(u: pbandk.MessageDecoder): EnumDescriptorProto { var name: String? = null var value: pbandk.ListWithSize.Builder? = null var options: pbandk.wkt.EnumOptions? = null @@ -2100,7 +2100,7 @@ private fun EnumDescriptorProto.EnumReservedRange.protoMergeImpl(plus: pbandk.Me ) ?: this @Suppress("UNCHECKED_CAST") -private fun EnumDescriptorProto.EnumReservedRange.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): EnumDescriptorProto.EnumReservedRange { +private fun EnumDescriptorProto.EnumReservedRange.Companion.decodeWithImpl(u: pbandk.MessageDecoder): EnumDescriptorProto.EnumReservedRange { var start: Int? = null var end: Int? = null @@ -2123,7 +2123,7 @@ private fun EnumValueDescriptorProto.protoMergeImpl(plus: pbandk.Message?): Enum ) ?: this @Suppress("UNCHECKED_CAST") -private fun EnumValueDescriptorProto.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): EnumValueDescriptorProto { +private fun EnumValueDescriptorProto.Companion.decodeWithImpl(u: pbandk.MessageDecoder): EnumValueDescriptorProto { var name: String? = null var number: Int? = null var options: pbandk.wkt.EnumValueOptions? = null @@ -2148,7 +2148,7 @@ private fun ServiceDescriptorProto.protoMergeImpl(plus: pbandk.Message?): Servic ) ?: this @Suppress("UNCHECKED_CAST") -private fun ServiceDescriptorProto.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): ServiceDescriptorProto { +private fun ServiceDescriptorProto.Companion.decodeWithImpl(u: pbandk.MessageDecoder): ServiceDescriptorProto { var name: String? = null var method: pbandk.ListWithSize.Builder? = null var options: pbandk.wkt.ServiceOptions? = null @@ -2176,7 +2176,7 @@ private fun MethodDescriptorProto.protoMergeImpl(plus: pbandk.Message?): MethodD ) ?: this @Suppress("UNCHECKED_CAST") -private fun MethodDescriptorProto.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): MethodDescriptorProto { +private fun MethodDescriptorProto.Companion.decodeWithImpl(u: pbandk.MessageDecoder): MethodDescriptorProto { var name: String? = null var inputType: String? = null var outputType: String? = null @@ -2226,7 +2226,7 @@ private fun FileOptions.protoMergeImpl(plus: pbandk.Message?): FileOptions = (pl ) ?: this @Suppress("UNCHECKED_CAST") -private fun FileOptions.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): FileOptions { +private fun FileOptions.Companion.decodeWithImpl(u: pbandk.MessageDecoder): FileOptions { var javaPackage: String? = null var javaOuterClassname: String? = null var javaMultipleFiles: Boolean? = null @@ -2294,7 +2294,7 @@ private fun MessageOptions.protoMergeImpl(plus: pbandk.Message?): MessageOptions ) ?: this @Suppress("UNCHECKED_CAST") -private fun MessageOptions.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): MessageOptions { +private fun MessageOptions.Companion.decodeWithImpl(u: pbandk.MessageDecoder): MessageOptions { var messageSetWireFormat: Boolean? = null var noStandardDescriptorAccessor: Boolean? = null var deprecated: Boolean? = null @@ -2328,7 +2328,7 @@ private fun FieldOptions.protoMergeImpl(plus: pbandk.Message?): FieldOptions = ( ) ?: this @Suppress("UNCHECKED_CAST") -private fun FieldOptions.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): FieldOptions { +private fun FieldOptions.Companion.decodeWithImpl(u: pbandk.MessageDecoder): FieldOptions { var ctype: pbandk.wkt.FieldOptions.CType? = null var packed: Boolean? = null var jstype: pbandk.wkt.FieldOptions.JSType? = null @@ -2360,7 +2360,7 @@ private fun OneofOptions.protoMergeImpl(plus: pbandk.Message?): OneofOptions = ( ) ?: this @Suppress("UNCHECKED_CAST") -private fun OneofOptions.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): OneofOptions { +private fun OneofOptions.Companion.decodeWithImpl(u: pbandk.MessageDecoder): OneofOptions { var uninterpretedOption: pbandk.ListWithSize.Builder? = null val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> @@ -2381,7 +2381,7 @@ private fun EnumOptions.protoMergeImpl(plus: pbandk.Message?): EnumOptions = (pl ) ?: this @Suppress("UNCHECKED_CAST") -private fun EnumOptions.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): EnumOptions { +private fun EnumOptions.Companion.decodeWithImpl(u: pbandk.MessageDecoder): EnumOptions { var allowAlias: Boolean? = null var deprecated: Boolean? = null var uninterpretedOption: pbandk.ListWithSize.Builder? = null @@ -2405,7 +2405,7 @@ private fun EnumValueOptions.protoMergeImpl(plus: pbandk.Message?): EnumValueOpt ) ?: this @Suppress("UNCHECKED_CAST") -private fun EnumValueOptions.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): EnumValueOptions { +private fun EnumValueOptions.Companion.decodeWithImpl(u: pbandk.MessageDecoder): EnumValueOptions { var deprecated: Boolean? = null var uninterpretedOption: pbandk.ListWithSize.Builder? = null @@ -2427,7 +2427,7 @@ private fun ServiceOptions.protoMergeImpl(plus: pbandk.Message?): ServiceOptions ) ?: this @Suppress("UNCHECKED_CAST") -private fun ServiceOptions.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): ServiceOptions { +private fun ServiceOptions.Companion.decodeWithImpl(u: pbandk.MessageDecoder): ServiceOptions { var deprecated: Boolean? = null var uninterpretedOption: pbandk.ListWithSize.Builder? = null @@ -2450,7 +2450,7 @@ private fun MethodOptions.protoMergeImpl(plus: pbandk.Message?): MethodOptions = ) ?: this @Suppress("UNCHECKED_CAST") -private fun MethodOptions.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): MethodOptions { +private fun MethodOptions.Companion.decodeWithImpl(u: pbandk.MessageDecoder): MethodOptions { var deprecated: Boolean? = null var idempotencyLevel: pbandk.wkt.MethodOptions.IdempotencyLevel? = null var uninterpretedOption: pbandk.ListWithSize.Builder? = null @@ -2479,7 +2479,7 @@ private fun UninterpretedOption.protoMergeImpl(plus: pbandk.Message?): Uninterpr ) ?: this @Suppress("UNCHECKED_CAST") -private fun UninterpretedOption.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): UninterpretedOption { +private fun UninterpretedOption.Companion.decodeWithImpl(u: pbandk.MessageDecoder): UninterpretedOption { var name: pbandk.ListWithSize.Builder? = null var identifierValue: String? = null var positiveIntValue: Long? = null @@ -2510,7 +2510,7 @@ private fun UninterpretedOption.NamePart.protoMergeImpl(plus: pbandk.Message?): ) ?: this @Suppress("UNCHECKED_CAST") -private fun UninterpretedOption.NamePart.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): UninterpretedOption.NamePart { +private fun UninterpretedOption.NamePart.Companion.decodeWithImpl(u: pbandk.MessageDecoder): UninterpretedOption.NamePart { var namePart = "" var isExtension = false @@ -2531,7 +2531,7 @@ private fun SourceCodeInfo.protoMergeImpl(plus: pbandk.Message?): SourceCodeInfo ) ?: this @Suppress("UNCHECKED_CAST") -private fun SourceCodeInfo.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): SourceCodeInfo { +private fun SourceCodeInfo.Companion.decodeWithImpl(u: pbandk.MessageDecoder): SourceCodeInfo { var location: pbandk.ListWithSize.Builder? = null val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> @@ -2554,7 +2554,7 @@ private fun SourceCodeInfo.Location.protoMergeImpl(plus: pbandk.Message?): Sourc ) ?: this @Suppress("UNCHECKED_CAST") -private fun SourceCodeInfo.Location.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): SourceCodeInfo.Location { +private fun SourceCodeInfo.Location.Companion.decodeWithImpl(u: pbandk.MessageDecoder): SourceCodeInfo.Location { var path: pbandk.ListWithSize.Builder? = null var span: pbandk.ListWithSize.Builder? = null var leadingComments: String? = null @@ -2582,7 +2582,7 @@ private fun GeneratedCodeInfo.protoMergeImpl(plus: pbandk.Message?): GeneratedCo ) ?: this @Suppress("UNCHECKED_CAST") -private fun GeneratedCodeInfo.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): GeneratedCodeInfo { +private fun GeneratedCodeInfo.Companion.decodeWithImpl(u: pbandk.MessageDecoder): GeneratedCodeInfo { var annotation: pbandk.ListWithSize.Builder? = null val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> @@ -2604,7 +2604,7 @@ private fun GeneratedCodeInfo.Annotation.protoMergeImpl(plus: pbandk.Message?): ) ?: this @Suppress("UNCHECKED_CAST") -private fun GeneratedCodeInfo.Annotation.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): GeneratedCodeInfo.Annotation { +private fun GeneratedCodeInfo.Annotation.Companion.decodeWithImpl(u: pbandk.MessageDecoder): GeneratedCodeInfo.Annotation { var path: pbandk.ListWithSize.Builder? = null var sourceFile: String? = null var begin: Int? = null diff --git a/runtime/src/commonMain/kotlin/pbandk/wkt/duration.kt b/runtime/src/commonMain/kotlin/pbandk/wkt/duration.kt index 1da9c0e7..437a17cb 100644 --- a/runtime/src/commonMain/kotlin/pbandk/wkt/duration.kt +++ b/runtime/src/commonMain/kotlin/pbandk/wkt/duration.kt @@ -12,7 +12,7 @@ data class Duration( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { Duration() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = Duration.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = Duration.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -48,7 +48,7 @@ private fun Duration.protoMergeImpl(plus: pbandk.Message?): Duration = (plus as? ) ?: this @Suppress("UNCHECKED_CAST") -private fun Duration.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): Duration { +private fun Duration.Companion.decodeWithImpl(u: pbandk.MessageDecoder): Duration { var seconds = 0L var nanos = 0 diff --git a/runtime/src/commonMain/kotlin/pbandk/wkt/empty.kt b/runtime/src/commonMain/kotlin/pbandk/wkt/empty.kt index 9d34ab0c..3e6f7100 100644 --- a/runtime/src/commonMain/kotlin/pbandk/wkt/empty.kt +++ b/runtime/src/commonMain/kotlin/pbandk/wkt/empty.kt @@ -10,7 +10,7 @@ data class Empty( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { Empty() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = Empty.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = Empty.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -30,7 +30,7 @@ private fun Empty.protoMergeImpl(plus: pbandk.Message?): Empty = (plus as? Empty ) ?: this @Suppress("UNCHECKED_CAST") -private fun Empty.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): Empty { +private fun Empty.Companion.decodeWithImpl(u: pbandk.MessageDecoder): Empty { val unknownFields = u.readMessage(this) { _, _ -> } return Empty(unknownFields) diff --git a/runtime/src/commonMain/kotlin/pbandk/wkt/field_mask.kt b/runtime/src/commonMain/kotlin/pbandk/wkt/field_mask.kt index b71ec2aa..d74bc2f4 100644 --- a/runtime/src/commonMain/kotlin/pbandk/wkt/field_mask.kt +++ b/runtime/src/commonMain/kotlin/pbandk/wkt/field_mask.kt @@ -11,7 +11,7 @@ data class FieldMask( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { FieldMask() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = FieldMask.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = FieldMask.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -40,7 +40,7 @@ private fun FieldMask.protoMergeImpl(plus: pbandk.Message?): FieldMask = (plus a ) ?: this @Suppress("UNCHECKED_CAST") -private fun FieldMask.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): FieldMask { +private fun FieldMask.Companion.decodeWithImpl(u: pbandk.MessageDecoder): FieldMask { var paths: pbandk.ListWithSize.Builder? = null val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> diff --git a/runtime/src/commonMain/kotlin/pbandk/wkt/source_context.kt b/runtime/src/commonMain/kotlin/pbandk/wkt/source_context.kt index ca3daff8..8f86259c 100644 --- a/runtime/src/commonMain/kotlin/pbandk/wkt/source_context.kt +++ b/runtime/src/commonMain/kotlin/pbandk/wkt/source_context.kt @@ -11,7 +11,7 @@ data class SourceContext( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { SourceContext() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = SourceContext.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = SourceContext.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -39,7 +39,7 @@ private fun SourceContext.protoMergeImpl(plus: pbandk.Message?): SourceContext = ) ?: this @Suppress("UNCHECKED_CAST") -private fun SourceContext.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): SourceContext { +private fun SourceContext.Companion.decodeWithImpl(u: pbandk.MessageDecoder): SourceContext { var fileName = "" val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> diff --git a/runtime/src/commonMain/kotlin/pbandk/wkt/struct.kt b/runtime/src/commonMain/kotlin/pbandk/wkt/struct.kt index c47ca12d..cfac4f0c 100644 --- a/runtime/src/commonMain/kotlin/pbandk/wkt/struct.kt +++ b/runtime/src/commonMain/kotlin/pbandk/wkt/struct.kt @@ -26,7 +26,7 @@ data class Struct( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { Struct() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = Struct.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = Struct.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -56,7 +56,7 @@ data class Struct( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { Struct.FieldsEntry() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = Struct.FieldsEntry.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = Struct.FieldsEntry.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -117,7 +117,7 @@ data class Value( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { Value() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = Value.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = Value.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -193,7 +193,7 @@ data class ListValue( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { ListValue() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = ListValue.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = ListValue.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -222,7 +222,7 @@ private fun Struct.protoMergeImpl(plus: pbandk.Message?): Struct = (plus as? Str ) ?: this @Suppress("UNCHECKED_CAST") -private fun Struct.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): Struct { +private fun Struct.Companion.decodeWithImpl(u: pbandk.MessageDecoder): Struct { var fields: pbandk.MessageMap.Builder? = null val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> @@ -241,7 +241,7 @@ private fun Struct.FieldsEntry.protoMergeImpl(plus: pbandk.Message?): Struct.Fie ) ?: this @Suppress("UNCHECKED_CAST") -private fun Struct.FieldsEntry.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): Struct.FieldsEntry { +private fun Struct.FieldsEntry.Companion.decodeWithImpl(u: pbandk.MessageDecoder): Struct.FieldsEntry { var key = "" var value: pbandk.wkt.Value? = null @@ -269,7 +269,7 @@ private fun Value.protoMergeImpl(plus: pbandk.Message?): Value = (plus as? Value ) ?: this @Suppress("UNCHECKED_CAST") -private fun Value.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): Value { +private fun Value.Companion.decodeWithImpl(u: pbandk.MessageDecoder): Value { var kind: Value.Kind<*>? = null val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> @@ -293,7 +293,7 @@ private fun ListValue.protoMergeImpl(plus: pbandk.Message?): ListValue = (plus a ) ?: this @Suppress("UNCHECKED_CAST") -private fun ListValue.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): ListValue { +private fun ListValue.Companion.decodeWithImpl(u: pbandk.MessageDecoder): ListValue { var values: pbandk.ListWithSize.Builder? = null val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> diff --git a/runtime/src/commonMain/kotlin/pbandk/wkt/timestamp.kt b/runtime/src/commonMain/kotlin/pbandk/wkt/timestamp.kt index e1f5cae1..f44a644a 100644 --- a/runtime/src/commonMain/kotlin/pbandk/wkt/timestamp.kt +++ b/runtime/src/commonMain/kotlin/pbandk/wkt/timestamp.kt @@ -12,7 +12,7 @@ data class Timestamp( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { Timestamp() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = Timestamp.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = Timestamp.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -48,7 +48,7 @@ private fun Timestamp.protoMergeImpl(plus: pbandk.Message?): Timestamp = (plus a ) ?: this @Suppress("UNCHECKED_CAST") -private fun Timestamp.Companion.unmarshalImpl(u: pbandk.MessageUnmarshaller): Timestamp { +private fun Timestamp.Companion.decodeWithImpl(u: pbandk.MessageDecoder): Timestamp { var seconds = 0L var nanos = 0 diff --git a/runtime/src/commonMain/kotlin/pbandk/wkt/type.kt b/runtime/src/commonMain/kotlin/pbandk/wkt/type.kt index eaef90b0..ca77af7d 100644 --- a/runtime/src/commonMain/kotlin/pbandk/wkt/type.kt +++ b/runtime/src/commonMain/kotlin/pbandk/wkt/type.kt @@ -32,7 +32,7 @@ data class Type( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { Type() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = Type.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = Type.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -111,7 +111,7 @@ data class Field( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { Field() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = Field.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = Field.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -268,7 +268,7 @@ data class Enum( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { Enum() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = Enum.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = Enum.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -332,7 +332,7 @@ data class EnumValue( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion { val defaultInstance by lazy { EnumValue() } - override fun unmarshal(u: pbandk.MessageUnmarshaller) = EnumValue.unmarshalImpl(u) + override fun decodeWith(u: pbandk.MessageDecoder) = EnumValue.decodeWithImpl(u) override val descriptor: pbandk.MessageDescriptor by lazy { pbandk.MessageDescriptor( @@ -379,7 +379,7 @@ data class Option( override val protoSize by lazy { super.protoSize } companion object : pbandk.Message.Companion