pull/9494/head
Deanna Garcia 3 years ago
parent c946f0bb70
commit e760984a59
  1. 16
      BUILD
  2. 15
      java/kotlin/BUILD
  3. 6
      protobuf_deps.bzl
  4. 22
      src/google/protobuf/compiler/java/java_message.cc
  5. 12
      src/google/protobuf/compiler/java/java_message_field.cc
  6. 12
      src/google/protobuf/compiler/java/java_message_field_lite.cc
  7. 16
      src/google/protobuf/compiler/java/java_message_lite.cc

16
BUILD

@ -1485,6 +1485,7 @@ genrule(
outs = [ outs = [
"TestAllTypesKt.kt", "TestAllTypesKt.kt",
"ForeignMessageKt.kt", "ForeignMessageKt.kt",
"Int32MessageKt.kt",
"TestAllExtensionsKt.kt", "TestAllExtensionsKt.kt",
"TestEmptyMessageKt.kt", "TestEmptyMessageKt.kt",
"TestEmptyMessageWithExtensionsKt.kt", "TestEmptyMessageWithExtensionsKt.kt",
@ -1505,6 +1506,8 @@ genrule(
"$(location TestAllTypesKt.kt) && " + "$(location TestAllTypesKt.kt) && " +
"cp $(@D)/protobuf_unittest/ForeignMessageKt.kt " + "cp $(@D)/protobuf_unittest/ForeignMessageKt.kt " +
"$(location ForeignMessageKt.kt) && " + "$(location ForeignMessageKt.kt) && " +
"cp $(@D)/protobuf_unittest/Int32MessageKt.kt " +
"$(location Int32MessageKt.kt) && " +
"cp $(@D)/protobuf_unittest/TestAllExtensionsKt.kt " + "cp $(@D)/protobuf_unittest/TestAllExtensionsKt.kt " +
"$(location TestAllExtensionsKt.kt) && " + "$(location TestAllExtensionsKt.kt) && " +
"cp $(@D)/protobuf_unittest/TestEmptyMessageKt.kt " + "cp $(@D)/protobuf_unittest/TestEmptyMessageKt.kt " +
@ -1568,3 +1571,16 @@ genrule(
tools = ["//:protoc"], tools = ["//:protoc"],
) )
genrule(
name = "gen_kotlin_any",
srcs = ["src/google/protobuf/any.proto"],
outs = ["AnyKt.kt"],
visibility = ["//java:__subpackages__"],
cmd = "$(location //:protoc) " +
"--kotlin_out=shared,immutable:$(@D) -Isrc/ " +
"$(location src/google/protobuf/any.proto) && " +
"cp $(@D)/com/google/protobuf/AnyKt.kt " +
"$(location AnyKt.kt)",
tools = ["//:protoc"],
)

@ -1,5 +1,6 @@
load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")
load("@rules_java//java:defs.bzl", "java_proto_library") load("@rules_java//java:defs.bzl", "java_proto_library")
load("@rules_jvm_external//:kt_defs.bzl", "kt_jvm_export")
load("@rules_proto//proto:defs.bzl", "proto_library") load("@rules_proto//proto:defs.bzl", "proto_library")
load("//:protobuf_version.bzl", "PROTOBUF_VERSION") load("//:protobuf_version.bzl", "PROTOBUF_VERSION")
@ -35,7 +36,10 @@ kt_jvm_library(
kt_jvm_library( kt_jvm_library(
name = "full_extensions", name = "full_extensions",
srcs = ["src/main/kotlin/com/google/protobuf/ExtendableMessageExtensions.kt"], srcs = [
"src/main/kotlin/com/google/protobuf/Anies.kt",
"src/main/kotlin/com/google/protobuf/ExtendableMessageExtensions.kt",
],
deps = ["//java/core"], deps = ["//java/core"],
) )
@ -106,11 +110,15 @@ java_test(
kt_jvm_library( kt_jvm_library(
name = "test_extensions_library", name = "test_extensions_library",
srcs = ["src/test/kotlin/com/google/protobuf/ExtendableMessageExtensionsTest.kt"], srcs = [
"src/test/kotlin/com/google/protobuf/AniesTest.kt",
"src/test/kotlin/com/google/protobuf/ExtendableMessageExtensionsTest.kt",
],
deps = [ deps = [
":example_extensible_message_java_proto", ":example_extensible_message_java_proto",
":full_extensions", ":full_extensions",
"//java/lite", "//java/core:core",
":kotlin_unittest",
":only_for_use_in_proto_generated_code_its_generator_and_tests", ":only_for_use_in_proto_generated_code_its_generator_and_tests",
":shared_runtime", ":shared_runtime",
"@com_github_jetbrains_kotlin//:kotlin-test", "@com_github_jetbrains_kotlin//:kotlin-test",
@ -221,6 +229,7 @@ kt_jvm_library(
name = "kotlin_unittest", name = "kotlin_unittest",
srcs = [ srcs = [
":gen_evil_names_proto2", ":gen_evil_names_proto2",
"//:gen_kotlin_any",
"//:gen_kotlin_unittest", "//:gen_kotlin_unittest",
], ],
deps = [ deps = [

@ -70,9 +70,9 @@ def protobuf_deps():
if not native.existing_rule("rules_jvm_external"): if not native.existing_rule("rules_jvm_external"):
http_archive( http_archive(
name = "rules_jvm_external", name = "rules_jvm_external",
sha256 = "f36441aa876c4f6427bfb2d1f2d723b48e9d930b62662bf723ddfb8fc80f0140", sha256 = "744bd7436f63af7e9872948773b8b106016dc164acb3960b4963f86754532ee7",
strip_prefix = "rules_jvm_external-4.1", strip_prefix = "rules_jvm_external-906875b0d5eaaf61a8ca2c9c3835bde6f435d011",
urls = ["https://github.com/bazelbuild/rules_jvm_external/archive/4.1.zip"], urls = ["https://github.com/bazelbuild/rules_jvm_external/archive/906875b0d5eaaf61a8ca2c9c3835bde6f435d011.zip"],
) )
if not native.existing_rule("rules_pkg"): if not native.existing_rule("rules_pkg"):

@ -1526,7 +1526,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions(
printer->Print( printer->Print(
"@Suppress(\"UNCHECKED_CAST\")\n" "@Suppress(\"UNCHECKED_CAST\")\n"
"@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmSynthetic\n"
"public operator fun <T> get(extension: " "public operator fun <T : Any> get(extension: "
"com.google.protobuf.ExtensionLite<$message$, T>): T {\n" "com.google.protobuf.ExtensionLite<$message$, T>): T {\n"
" return if (extension.isRepeated) {\n" " return if (extension.isRepeated) {\n"
" get(extension as com.google.protobuf.ExtensionLite<$message$, " " get(extension as com.google.protobuf.ExtensionLite<$message$, "
@ -1542,7 +1542,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions(
"@kotlin.OptIn" "@kotlin.OptIn"
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
"@kotlin.jvm.JvmName(\"-getRepeatedExtension\")\n" "@kotlin.jvm.JvmName(\"-getRepeatedExtension\")\n"
"public operator fun <E> get(\n" "public operator fun <E : Any> get(\n"
" extension: com.google.protobuf.ExtensionLite<$message$, List<E>>\n" " extension: com.google.protobuf.ExtensionLite<$message$, List<E>>\n"
"): com.google.protobuf.kotlin.ExtensionList<E, $message$> {\n" "): com.google.protobuf.kotlin.ExtensionList<E, $message$> {\n"
" return com.google.protobuf.kotlin.ExtensionList(extension, " " return com.google.protobuf.kotlin.ExtensionList(extension, "
@ -1571,7 +1571,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions(
printer->Print( printer->Print(
"@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmSynthetic\n"
"@kotlin.PublishedApi\n" "@kotlin.PublishedApi\n"
"internal fun <T> setExtension(extension: " "internal fun <T : Any> setExtension(extension: "
"com.google.protobuf.ExtensionLite<$message$, T>, " "com.google.protobuf.ExtensionLite<$message$, T>, "
"value: T) {\n" "value: T) {\n"
" _builder.setExtension(extension, value)\n" " _builder.setExtension(extension, value)\n"
@ -1585,7 +1585,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions(
" extension: com.google.protobuf.ExtensionLite<$message$, T>,\n" " extension: com.google.protobuf.ExtensionLite<$message$, T>,\n"
" value: T\n" " value: T\n"
") {\n" ") {\n"
" setExtension(extension, value)\n" " setExtension(extension, value!!)\n"
"}\n\n", "}\n\n",
"message", message_name); "message", message_name);
@ -1597,7 +1597,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions(
"com.google.protobuf.ByteString>,\n" "com.google.protobuf.ByteString>,\n"
" value: com.google.protobuf.ByteString\n" " value: com.google.protobuf.ByteString\n"
") {\n" ") {\n"
" setExtension(extension, value)\n" " setExtension(extension, value!!)\n"
"}\n\n", "}\n\n",
"message", message_name); "message", message_name);
@ -1608,13 +1608,13 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions(
" extension: com.google.protobuf.ExtensionLite<$message$, T>,\n" " extension: com.google.protobuf.ExtensionLite<$message$, T>,\n"
" value: T\n" " value: T\n"
") {\n" ") {\n"
" setExtension(extension, value)\n" " setExtension(extension, value!!)\n"
"}\n\n", "}\n\n",
"message", message_name); "message", message_name);
printer->Print( printer->Print(
"@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmSynthetic\n"
"public fun <E> com.google.protobuf.kotlin.ExtensionList<E, " "public fun <E : Any> com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.add(value: E) {\n" "$message$>.add(value: E) {\n"
" _builder.addExtension(this.extension, value)\n" " _builder.addExtension(this.extension, value)\n"
"}\n\n", "}\n\n",
@ -1623,7 +1623,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions(
printer->Print( printer->Print(
"@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n" "@Suppress(\"NOTHING_TO_INLINE\")\n"
"public inline operator fun <E> " "public inline operator fun <E : Any> "
"com.google.protobuf.kotlin.ExtensionList<E, " "com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.plusAssign" "$message$>.plusAssign"
"(value: E) {\n" "(value: E) {\n"
@ -1633,7 +1633,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions(
printer->Print( printer->Print(
"@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmSynthetic\n"
"public fun <E> com.google.protobuf.kotlin.ExtensionList<E, " "public fun <E : Any> com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.addAll(values: Iterable<E>) {\n" "$message$>.addAll(values: Iterable<E>) {\n"
" for (value in values) {\n" " for (value in values) {\n"
" add(value)\n" " add(value)\n"
@ -1644,7 +1644,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions(
printer->Print( printer->Print(
"@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n" "@Suppress(\"NOTHING_TO_INLINE\")\n"
"public inline operator fun <E> " "public inline operator fun <E : Any> "
"com.google.protobuf.kotlin.ExtensionList<E, " "com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.plusAssign(values: " "$message$>.plusAssign(values: "
"Iterable<E>) {\n" "Iterable<E>) {\n"
@ -1654,7 +1654,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions(
printer->Print( printer->Print(
"@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmSynthetic\n"
"public operator fun <E> " "public operator fun <E : Any> "
"com.google.protobuf.kotlin.ExtensionList<E, " "com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.set(index: Int, value: " "$message$>.set(index: Int, value: "
"E) {\n" "E) {\n"

@ -1438,7 +1438,7 @@ void RepeatedImmutableMessageFieldGenerator::GenerateKotlinDslMembers(
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"add(value: $kt_type$) {\n" "add(value: $kt_type$) {\n"
" $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
"}"); "}\n");
WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
/* builder */ false); /* builder */ false);
@ -1450,7 +1450,7 @@ void RepeatedImmutableMessageFieldGenerator::GenerateKotlinDslMembers(
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: $kt_type$) {\n" "plusAssign(value: $kt_type$) {\n"
" add(value)\n" " add(value)\n"
"}"); "}\n");
WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
/* builder */ false); /* builder */ false);
@ -1461,7 +1461,7 @@ void RepeatedImmutableMessageFieldGenerator::GenerateKotlinDslMembers(
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n" "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n"
" $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
"}"); "}\n");
WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
/* builder */ false); /* builder */ false);
@ -1474,7 +1474,7 @@ void RepeatedImmutableMessageFieldGenerator::GenerateKotlinDslMembers(
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n" "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"
" addAll(values)\n" " addAll(values)\n"
"}"); "}\n");
WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER,
/* builder */ false); /* builder */ false);
@ -1486,7 +1486,7 @@ void RepeatedImmutableMessageFieldGenerator::GenerateKotlinDslMembers(
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"set(index: kotlin.Int, value: $kt_type$) {\n" "set(index: kotlin.Int, value: $kt_type$) {\n"
" $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n" " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
"}"); "}\n");
WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
/* builder */ false); /* builder */ false);
@ -1497,7 +1497,7 @@ void RepeatedImmutableMessageFieldGenerator::GenerateKotlinDslMembers(
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"clear() {\n" "clear() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
"}"); "}\n\n");
} }
} // namespace java } // namespace java

@ -825,7 +825,7 @@ void RepeatedImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers(
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"add(value: $kt_type$) {\n" "add(value: $kt_type$) {\n"
" $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
"}"); "}\n");
WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
/* builder */ false); /* builder */ false);
@ -837,7 +837,7 @@ void RepeatedImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers(
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: $kt_type$) {\n" "plusAssign(value: $kt_type$) {\n"
" add(value)\n" " add(value)\n"
"}"); "}\n");
WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
/* builder */ false); /* builder */ false);
@ -848,7 +848,7 @@ void RepeatedImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers(
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n" "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n"
" $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
"}"); "}\n");
WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
/* builder */ false); /* builder */ false);
@ -861,7 +861,7 @@ void RepeatedImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers(
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n" "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"
" addAll(values)\n" " addAll(values)\n"
"}"); "}\n");
WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER,
/* builder */ false); /* builder */ false);
@ -873,7 +873,7 @@ void RepeatedImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers(
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"set(index: kotlin.Int, value: $kt_type$) {\n" "set(index: kotlin.Int, value: $kt_type$) {\n"
" $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n" " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
"}"); "}\n");
WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
/* builder */ false); /* builder */ false);
@ -884,7 +884,7 @@ void RepeatedImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers(
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"clear() {\n" "clear() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
"}"); "}\n");
} }
} // namespace java } // namespace java

@ -847,7 +847,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions(
printer->Print( printer->Print(
"@Suppress(\"UNCHECKED_CAST\")\n" "@Suppress(\"UNCHECKED_CAST\")\n"
"@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmSynthetic\n"
"public operator fun <T> get(extension: " "public operator fun <T : Any> get(extension: "
"com.google.protobuf.ExtensionLite<$message$, T>): T {\n" "com.google.protobuf.ExtensionLite<$message$, T>): T {\n"
" return if (extension.isRepeated) {\n" " return if (extension.isRepeated) {\n"
" get(extension as com.google.protobuf.ExtensionLite<$message$, " " get(extension as com.google.protobuf.ExtensionLite<$message$, "
@ -863,7 +863,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions(
"@kotlin.OptIn" "@kotlin.OptIn"
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
"@kotlin.jvm.JvmName(\"-getRepeatedExtension\")\n" "@kotlin.jvm.JvmName(\"-getRepeatedExtension\")\n"
"public operator fun <E> get(\n" "public operator fun <E : Any> get(\n"
" extension: com.google.protobuf.ExtensionLite<$message$, List<E>>\n" " extension: com.google.protobuf.ExtensionLite<$message$, List<E>>\n"
"): com.google.protobuf.kotlin.ExtensionList<E, $message$> {\n" "): com.google.protobuf.kotlin.ExtensionList<E, $message$> {\n"
" return com.google.protobuf.kotlin.ExtensionList(extension, " " return com.google.protobuf.kotlin.ExtensionList(extension, "
@ -892,7 +892,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions(
printer->Print( printer->Print(
"@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmSynthetic\n"
"@kotlin.PublishedApi\n" "@kotlin.PublishedApi\n"
"internal fun <T> setExtension(extension: " "internal fun <T : Any> setExtension(extension: "
"com.google.protobuf.ExtensionLite<$message$, T>, " "com.google.protobuf.ExtensionLite<$message$, T>, "
"value: T) {\n" "value: T) {\n"
" _builder.setExtension(extension, value)\n" " _builder.setExtension(extension, value)\n"
@ -935,7 +935,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions(
printer->Print( printer->Print(
"@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmSynthetic\n"
"public fun<E> com.google.protobuf.kotlin.ExtensionList<E, " "public fun<E : Any> com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.add(value: E) {\n" "$message$>.add(value: E) {\n"
" _builder.addExtension(this.extension, value)\n" " _builder.addExtension(this.extension, value)\n"
"}\n\n", "}\n\n",
@ -944,7 +944,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions(
printer->Print( printer->Print(
"@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n" "@Suppress(\"NOTHING_TO_INLINE\")\n"
"public inline operator fun <E> " "public inline operator fun <E : Any> "
"com.google.protobuf.kotlin.ExtensionList<E, " "com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.plusAssign" "$message$>.plusAssign"
"(value: E) {\n" "(value: E) {\n"
@ -954,7 +954,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions(
printer->Print( printer->Print(
"@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmSynthetic\n"
"public fun<E> com.google.protobuf.kotlin.ExtensionList<E, " "public fun<E : Any> com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.addAll(values: Iterable<E>) {\n" "$message$>.addAll(values: Iterable<E>) {\n"
" for (value in values) {\n" " for (value in values) {\n"
" add(value)\n" " add(value)\n"
@ -965,7 +965,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions(
printer->Print( printer->Print(
"@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n" "@Suppress(\"NOTHING_TO_INLINE\")\n"
"public inline operator fun <E> " "public inline operator fun <E : Any> "
"com.google.protobuf.kotlin.ExtensionList<E, " "com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.plusAssign(values: " "$message$>.plusAssign(values: "
"Iterable<E>) {\n" "Iterable<E>) {\n"
@ -975,7 +975,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions(
printer->Print( printer->Print(
"@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmSynthetic\n"
"public operator fun <E> " "public operator fun <E : Any> "
"com.google.protobuf.kotlin.ExtensionList<E, " "com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.set(index: Int, value: " "$message$>.set(index: Int, value: "
"E) {\n" "E) {\n"

Loading…
Cancel
Save