Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add public modifiers to kotlin code #11068

Merged
merged 2 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/google/protobuf/compiler/java/enum_field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ void ImmutableEnumFieldGenerator::GenerateKotlinDslMembers(
io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
"$kt_deprecation$ var $kt_name$: $kt_type$\n"
"$kt_deprecation$public var $kt_name$: $kt_type$\n"
" @JvmName(\"${$get$kt_capitalized_name$$}$\")\n"
" get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n"
" @JvmName(\"${$set$kt_capitalized_name$$}$\")\n"
Expand All @@ -288,15 +288,15 @@ void ImmutableEnumFieldGenerator::GenerateKotlinDslMembers(
WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
/* builder */ false);
printer->Print(variables_,
"fun ${$clear$kt_capitalized_name$$}$() {\n"
"public fun ${$clear$kt_capitalized_name$$}$() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
"}\n");

if (HasHazzer(descriptor_)) {
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(
variables_,
"fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
"public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
" return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
"}\n");
}
Expand Down Expand Up @@ -1054,12 +1054,12 @@ void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers(
" */\n"
"@kotlin.OptIn"
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
"class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
"public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
" : com.google.protobuf.kotlin.DslProxy()\n");

WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
"$kt_deprecation$ val $kt_name$: "
"$kt_deprecation$public val $kt_name$: "
"com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" @kotlin.jvm.JvmSynthetic\n"
Expand All @@ -1072,7 +1072,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers(
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
"fun com.google.protobuf.kotlin.DslList"
"public fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"add(value: $kt_type$) {\n"
" $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
Expand All @@ -1084,7 +1084,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers(
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslList"
"public inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: $kt_type$) {\n"
" add(value)\n"
Expand All @@ -1095,7 +1095,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers(
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
"fun com.google.protobuf.kotlin.DslList"
"public fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n"
" $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
Expand All @@ -1108,7 +1108,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers(
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslList"
"public inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"
" addAll(values)\n"
Expand All @@ -1120,7 +1120,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers(
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
"operator fun com.google.protobuf.kotlin.DslList"
"public operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"set(index: kotlin.Int, value: $kt_type$) {\n"
" $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
Expand All @@ -1131,7 +1131,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers(
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
"fun com.google.protobuf.kotlin.DslList"
"public fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"clear() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
Expand Down
22 changes: 11 additions & 11 deletions src/google/protobuf/compiler/java/enum_field_lite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ void ImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers(
io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
"$kt_deprecation$var $kt_name$: $kt_type$\n"
"$kt_deprecation$public var $kt_name$: $kt_type$\n"
" @JvmName(\"${$get$kt_capitalized_name$$}$\")\n"
" get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n"
" @JvmName(\"${$set$kt_capitalized_name$$}$\")\n"
Expand All @@ -299,15 +299,15 @@ void ImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers(
WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
/* builder */ false);
printer->Print(variables_,
"fun ${$clear$kt_capitalized_name$$}$() {\n"
"public fun ${$clear$kt_capitalized_name$$}$() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
"}\n");

if (HasHazzer(descriptor_)) {
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(
variables_,
"fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
"public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
" return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
"}\n");
}
Expand Down Expand Up @@ -827,12 +827,12 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers(
" */\n"
"@kotlin.OptIn"
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
"class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
"public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
" : com.google.protobuf.kotlin.DslProxy()\n");

WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
"$kt_deprecation$ val $kt_name$: "
"$kt_deprecation$ public val $kt_name$: "
"com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" @kotlin.jvm.JvmSynthetic\n"
Expand All @@ -845,7 +845,7 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers(
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
"fun com.google.protobuf.kotlin.DslList"
"public fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"add(value: $kt_type$) {\n"
" $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
Expand All @@ -857,7 +857,7 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers(
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslList"
"public inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: $kt_type$) {\n"
" add(value)\n"
Expand All @@ -868,7 +868,7 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers(
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
"fun com.google.protobuf.kotlin.DslList"
"public fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n"
" $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
Expand All @@ -881,7 +881,7 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers(
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslList"
"public inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"
" addAll(values)\n"
Expand All @@ -893,7 +893,7 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers(
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
"operator fun com.google.protobuf.kotlin.DslList"
"public operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"set(index: kotlin.Int, value: $kt_type$) {\n"
" $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
Expand All @@ -904,7 +904,7 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers(
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
"fun com.google.protobuf.kotlin.DslList"
"public fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"clear() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
Expand Down
12 changes: 6 additions & 6 deletions src/google/protobuf/compiler/java/map_field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -735,13 +735,13 @@ void ImmutableMapFieldGenerator::GenerateKotlinDslMembers(
" */\n"
"@kotlin.OptIn"
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
"class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
"public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
" : com.google.protobuf.kotlin.DslProxy()\n");

WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$kt_deprecation$ val $kt_name$: "
"$kt_deprecation$ public val $kt_name$: "
"com.google.protobuf.kotlin.DslMap"
"<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" @kotlin.jvm.JvmSynthetic\n"
Expand All @@ -754,7 +754,7 @@ void ImmutableMapFieldGenerator::GenerateKotlinDslMembers(
printer->Print(
variables_,
"@JvmName(\"put$kt_capitalized_name$\")\n"
"fun com.google.protobuf.kotlin.DslMap"
"public fun com.google.protobuf.kotlin.DslMap"
"<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" .put(key: $kt_key_type$, value: $kt_value_type$) {\n"
" $kt_dsl_builder$.${$put$capitalized_name$$}$(key, value)\n"
Expand All @@ -766,7 +766,7 @@ void ImmutableMapFieldGenerator::GenerateKotlinDslMembers(
"@kotlin.jvm.JvmSynthetic\n"
"@JvmName(\"set$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslMap"
"public inline operator fun com.google.protobuf.kotlin.DslMap"
"<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" .set(key: $kt_key_type$, value: $kt_value_type$) {\n"
" put(key, value)\n"
Expand All @@ -777,7 +777,7 @@ void ImmutableMapFieldGenerator::GenerateKotlinDslMembers(
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@JvmName(\"remove$kt_capitalized_name$\")\n"
"fun com.google.protobuf.kotlin.DslMap"
"public fun com.google.protobuf.kotlin.DslMap"
"<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" .remove(key: $kt_key_type$) {\n"
" $kt_dsl_builder$.${$remove$capitalized_name$$}$(key)\n"
Expand All @@ -788,7 +788,7 @@ void ImmutableMapFieldGenerator::GenerateKotlinDslMembers(
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@JvmName(\"putAll$kt_capitalized_name$\")\n"
"fun com.google.protobuf.kotlin.DslMap"
"public fun com.google.protobuf.kotlin.DslMap"
"<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" .putAll(map: kotlin.collections.Map<$kt_key_type$, $kt_value_type$>) "
"{\n"
Expand Down
14 changes: 7 additions & 7 deletions src/google/protobuf/compiler/java/map_field_lite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -838,13 +838,13 @@ void ImmutableMapFieldLiteGenerator::GenerateKotlinDslMembers(
" */\n"
"@kotlin.OptIn"
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
"class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
"public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
" : com.google.protobuf.kotlin.DslProxy()\n");

WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$kt_deprecation$ val $kt_name$: "
"$kt_deprecation$ public val $kt_name$: "
"com.google.protobuf.kotlin.DslMap"
"<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" @kotlin.jvm.JvmSynthetic\n"
Expand All @@ -857,7 +857,7 @@ void ImmutableMapFieldLiteGenerator::GenerateKotlinDslMembers(
printer->Print(
variables_,
"@JvmName(\"put$kt_capitalized_name$\")\n"
"fun com.google.protobuf.kotlin.DslMap"
"public fun com.google.protobuf.kotlin.DslMap"
"<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" .put(key: $kt_key_type$, value: $kt_value_type$) {\n"
" $kt_dsl_builder$.${$put$capitalized_name$$}$(key, value)\n"
Expand All @@ -869,7 +869,7 @@ void ImmutableMapFieldLiteGenerator::GenerateKotlinDslMembers(
"@kotlin.jvm.JvmSynthetic\n"
"@JvmName(\"set$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslMap"
"public inline operator fun com.google.protobuf.kotlin.DslMap"
"<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" .set(key: $kt_key_type$, value: $kt_value_type$) {\n"
" put(key, value)\n"
Expand All @@ -880,7 +880,7 @@ void ImmutableMapFieldLiteGenerator::GenerateKotlinDslMembers(
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@JvmName(\"remove$kt_capitalized_name$\")\n"
"fun com.google.protobuf.kotlin.DslMap"
"public fun com.google.protobuf.kotlin.DslMap"
"<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" .remove(key: $kt_key_type$) {\n"
" $kt_dsl_builder$.${$remove$capitalized_name$$}$(key)\n"
Expand All @@ -891,7 +891,7 @@ void ImmutableMapFieldLiteGenerator::GenerateKotlinDslMembers(
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@JvmName(\"putAll$kt_capitalized_name$\")\n"
"fun com.google.protobuf.kotlin.DslMap"
"public fun com.google.protobuf.kotlin.DslMap"
"<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" .putAll(map: kotlin.collections.Map<$kt_key_type$, $kt_value_type$>) "
"{\n"
Expand All @@ -903,7 +903,7 @@ void ImmutableMapFieldLiteGenerator::GenerateKotlinDslMembers(
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@JvmName(\"clear$kt_capitalized_name$\")\n"
"fun com.google.protobuf.kotlin.DslMap"
"public fun com.google.protobuf.kotlin.DslMap"
"<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" .clear() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
Expand Down
Loading