attempting to upgrade to proto 3.5

This commit is contained in:
Kevin Darby committed 2018-12-28 16:02:52 +00:00
1 parent eb1b42a5e8
commit cc3510c6c2
368 files changed
+35764 -24867

No files matched your search

@@ -183,12 +183,14 @@ GenerateInterfaceMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$int get$capitalized_name$Count();\n");
"$deprecation$int ${$get$capitalized_name$Count$}$();\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$boolean contains$capitalized_name$(\n"
"$deprecation$boolean ${$contains$capitalized_name$$}$(\n"
" $key_type$ key);\n");
printer->Annotate("{", "}", descriptor_);
if (GetJavaType(ValueField(descriptor_)) == JAVATYPE_ENUM) {
printer->Print(
variables_,
@@ -197,23 +199,27 @@ GenerateInterfaceMembers(io::Printer* printer) const {
" */\n"
"@java.lang.Deprecated\n"
"java.util.Map<$boxed_key_type$, $value_enum_type$>\n"
"get$capitalized_name$();\n");
"${$get$capitalized_name$$}$();\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$java.util.Map<$boxed_key_type$, $value_enum_type$>\n"
"get$capitalized_name$Map();\n");
"${$get$capitalized_name$Map$}$();\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$$value_enum_type$ get$capitalized_name$OrDefault(\n"
"$deprecation$$value_enum_type$ ${$get$capitalized_name$OrDefault$}$(\n"
" $key_type$ key,\n"
" $value_enum_type$ defaultValue);\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$$value_enum_type$ get$capitalized_name$OrThrow(\n"
"$deprecation$$value_enum_type$ ${$get$capitalized_name$OrThrow$}$(\n"
" $key_type$ key);\n");
printer->Annotate("{", "}", descriptor_);
if (SupportUnknownEnumValue(descriptor_->file())) {
printer->Print(
variables_,
@@ -222,25 +228,29 @@ GenerateInterfaceMembers(io::Printer* printer) const {
" */\n"
"@java.lang.Deprecated\n"
"java.util.Map<$type_parameters$>\n"
"get$capitalized_name$Value();\n");
"${$get$capitalized_name$Value$}$();\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$java.util.Map<$type_parameters$>\n"
"get$capitalized_name$ValueMap();\n");
"${$get$capitalized_name$ValueMap$}$();\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$\n"
"$value_type$ get$capitalized_name$ValueOrDefault(\n"
"$value_type$ ${$get$capitalized_name$ValueOrDefault$}$(\n"
" $key_type$ key,\n"
" $value_type$ defaultValue);\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$\n"
"$value_type$ get$capitalized_name$ValueOrThrow(\n"
"$value_type$ ${$get$capitalized_name$ValueOrThrow$}$(\n"
" $key_type$ key);\n");
printer->Annotate("{", "}", descriptor_);
}
} else {
printer->Print(
@@ -250,25 +260,29 @@ GenerateInterfaceMembers(io::Printer* printer) const {
" */\n"
"@java.lang.Deprecated\n"
"java.util.Map<$type_parameters$>\n"
"get$capitalized_name$();\n");
"${$get$capitalized_name$$}$();\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$java.util.Map<$type_parameters$>\n"
"get$capitalized_name$Map();\n");
"${$get$capitalized_name$Map$}$();\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$\n"
"$value_type$ get$capitalized_name$OrDefault(\n"
"$value_type$ ${$get$capitalized_name$OrDefault$}$(\n"
" $key_type$ key,\n"
" $value_type$ defaultValue);\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$\n"
"$value_type$ get$capitalized_name$OrThrow(\n"
"$value_type$ ${$get$capitalized_name$OrThrow$}$(\n"
" $key_type$ key);\n");
printer->Annotate("{", "}", descriptor_);
}
}
@@ -349,23 +363,27 @@ GenerateBuilderMembers(io::Printer* printer) const {
" return $name$_;\n"
"}\n");
GenerateMapGetters(printer);
printer->Print(variables_,
"$deprecation$\n"
"public Builder clear$capitalized_name$() {\n"
" internalGetMutable$capitalized_name$().getMutableMap()\n"
" .clear();\n"
" return this;\n"
"}\n");
printer->Print(
variables_,
"$deprecation$\n"
"public Builder ${$clear$capitalized_name$$}$() {\n"
" internalGetMutable$capitalized_name$().getMutableMap()\n"
" .clear();\n"
" return this;\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
"$deprecation$\n"
"public Builder remove$capitalized_name$(\n"
" $key_type$ key) {\n"
" $key_null_check$\n"
" internalGetMutable$capitalized_name$().getMutableMap()\n"
" .remove(key);\n"
" return this;\n"
"}\n");
printer->Print(
variables_,
"$deprecation$\n"
"public Builder ${$remove$capitalized_name$$}$(\n"
" $key_type$ key) {\n"
" $key_null_check$\n"
" internalGetMutable$capitalized_name$().getMutableMap()\n"
" .remove(key);\n"
" return this;\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
if (GetJavaType(ValueField(descriptor_)) == JAVATYPE_ENUM) {
printer->Print(
variables_,
@@ -374,13 +392,14 @@ GenerateBuilderMembers(io::Printer* printer) const {
" */\n"
"@java.lang.Deprecated\n"
"public java.util.Map<$boxed_key_type$, $value_enum_type$>\n"
"getMutable$capitalized_name$() {\n"
"${$getMutable$capitalized_name$$}$() {\n"
" return internalGetAdapted$capitalized_name$Map(\n"
" internalGetMutable$capitalized_name$().getMutableMap());\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
"$deprecation$public Builder put$capitalized_name$(\n"
"$deprecation$public Builder ${$put$capitalized_name$$}$(\n"
" $key_type$ key,\n"
" $value_enum_type$ value) {\n"
" $key_null_check$\n"
@@ -389,16 +408,18 @@ GenerateBuilderMembers(io::Printer* printer) const {
" .put(key, $name$ValueConverter.doBackward(value));\n"
" return this;\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$public Builder putAll$capitalized_name$(\n"
"$deprecation$public Builder ${$putAll$capitalized_name$$}$(\n"
" java.util.Map<$boxed_key_type$, $value_enum_type$> values) {\n"
" internalGetAdapted$capitalized_name$Map(\n"
" internalGetMutable$capitalized_name$().getMutableMap())\n"
" .putAll(values);\n"
" return this;\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
if (SupportUnknownEnumValue(descriptor_->file())) {
printer->Print(
variables_,
@@ -407,32 +428,32 @@ GenerateBuilderMembers(io::Printer* printer) const {
" */\n"
"@java.lang.Deprecated\n"
"public java.util.Map<$boxed_key_type$, $boxed_value_type$>\n"
"getMutable$capitalized_name$Value() {\n"
"${$getMutable$capitalized_name$Value$}$() {\n"
" return internalGetMutable$capitalized_name$().getMutableMap();\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$public Builder put$capitalized_name$Value(\n"
"$deprecation$public Builder ${$put$capitalized_name$Value$}$(\n"
" $key_type$ key,\n"
" $value_type$ value) {\n"
" $key_null_check$\n"
" if ($value_enum_type$.forNumber(value) == null) {\n"
" throw new java.lang.IllegalArgumentException();\n"
" }\n"
" internalGetMutable$capitalized_name$().getMutableMap()\n"
" .put(key, value);\n"
" return this;\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$public Builder putAll$capitalized_name$Value(\n"
"$deprecation$public Builder ${$putAll$capitalized_name$Value$}$(\n"
" java.util.Map<$boxed_key_type$, $boxed_value_type$> values) {\n"
" internalGetMutable$capitalized_name$().getMutableMap()\n"
" .putAll(values);\n"
" return this;\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
}
} else {
printer->Print(
@@ -442,30 +463,35 @@ GenerateBuilderMembers(io::Printer* printer) const {
" */\n"
"@java.lang.Deprecated\n"
"public java.util.Map<$type_parameters$>\n"
"getMutable$capitalized_name$() {\n"
"${$getMutable$capitalized_name$$}$() {\n"
" return internalGetMutable$capitalized_name$().getMutableMap();\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
"$deprecation$"
"public Builder put$capitalized_name$(\n"
" $key_type$ key,\n"
" $value_type$ value) {\n"
" $key_null_check$\n"
" $value_null_check$\n"
" internalGetMutable$capitalized_name$().getMutableMap()\n"
" .put(key, value);\n"
" return this;\n"
"}\n");
printer->Print(
variables_,
"$deprecation$"
"public Builder ${$put$capitalized_name$$}$(\n"
" $key_type$ key,\n"
" $value_type$ value) {\n"
" $key_null_check$\n"
" $value_null_check$\n"
" internalGetMutable$capitalized_name$().getMutableMap()\n"
" .put(key, value);\n"
" return this;\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
"$deprecation$\n"
"public Builder putAll$capitalized_name$(\n"
" java.util.Map<$type_parameters$> values) {\n"
" internalGetMutable$capitalized_name$().getMutableMap()\n"
" .putAll(values);\n"
" return this;\n"
"}\n");
printer->Print(
variables_,
"$deprecation$\n"
"public Builder ${$putAll$capitalized_name$$}$(\n"
" java.util.Map<$type_parameters$> values) {\n"
" internalGetMutable$capitalized_name$().getMutableMap()\n"
" .putAll(values);\n"
" return this;\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
}
}
@@ -474,18 +500,20 @@ GenerateMapGetters(io::Printer* printer) const {
printer->Print(
variables_,
"$deprecation$\n"
"public int get$capitalized_name$Count() {\n"
"public int ${$get$capitalized_name$Count$}$() {\n"
" return internalGet$capitalized_name$().getMap().size();\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$\n"
"public boolean contains$capitalized_name$(\n"
"public boolean ${$contains$capitalized_name$$}$(\n"
" $key_type$ key) {\n"
" $key_null_check$\n"
" return internalGet$capitalized_name$().getMap().containsKey(key);\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
if (GetJavaType(ValueField(descriptor_)) == JAVATYPE_ENUM) {
printer->Print(
variables_,
@@ -494,22 +522,25 @@ GenerateMapGetters(io::Printer* printer) const {
" */\n"
"@java.lang.Deprecated\n"
"public java.util.Map<$boxed_key_type$, $value_enum_type$>\n"
"get$capitalized_name$() {\n"
"${$get$capitalized_name$$}$() {\n"
" return get$capitalized_name$Map();\n"
"}\n");
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
"$deprecation$\n"
"public java.util.Map<$boxed_key_type$, $value_enum_type$>\n"
"get$capitalized_name$Map() {\n"
" return internalGetAdapted$capitalized_name$Map(\n"
" internalGet$capitalized_name$().getMap());"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$\n"
"public $value_enum_type$ get$capitalized_name$OrDefault(\n"
"public java.util.Map<$boxed_key_type$, $value_enum_type$>\n"
"${$get$capitalized_name$Map$}$() {\n"
" return internalGetAdapted$capitalized_name$Map(\n"
" internalGet$capitalized_name$().getMap());"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$\n"
"public $value_enum_type$ ${$get$capitalized_name$OrDefault$}$(\n"
" $key_type$ key,\n"
" $value_enum_type$ defaultValue) {\n"
" $key_null_check$\n"
@@ -519,11 +550,12 @@ GenerateMapGetters(io::Printer* printer) const {
" ? $name$ValueConverter.doForward(map.get(key))\n"
" : defaultValue;\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$\n"
"public $value_enum_type$ get$capitalized_name$OrThrow(\n"
"public $value_enum_type$ ${$get$capitalized_name$OrThrow$}$(\n"
" $key_type$ key) {\n"
" $key_null_check$\n"
" java.util.Map<$boxed_key_type$, $boxed_value_type$> map =\n"
@@ -533,6 +565,7 @@ GenerateMapGetters(io::Printer* printer) const {
" }\n"
" return $name$ValueConverter.doForward(map.get(key));\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
if (SupportUnknownEnumValue(descriptor_->file())) {
printer->Print(
variables_,
@@ -541,22 +574,24 @@ GenerateMapGetters(io::Printer* printer) const {
" */\n"
"@java.lang.Deprecated\n"
"public java.util.Map<$boxed_key_type$, $boxed_value_type$>\n"
"get$capitalized_name$Value() {\n"
"${$get$capitalized_name$Value$}$() {\n"
" return get$capitalized_name$ValueMap();\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$\n"
"public java.util.Map<$boxed_key_type$, $boxed_value_type$>\n"
"get$capitalized_name$ValueMap() {\n"
"${$get$capitalized_name$ValueMap$}$() {\n"
" return internalGet$capitalized_name$().getMap();\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$\n"
"public $value_type$ get$capitalized_name$ValueOrDefault(\n"
"public $value_type$ ${$get$capitalized_name$ValueOrDefault$}$(\n"
" $key_type$ key,\n"
" $value_type$ defaultValue) {\n"
" $key_null_check$\n"
@@ -564,11 +599,12 @@ GenerateMapGetters(io::Printer* printer) const {
" internalGet$capitalized_name$().getMap();\n"
" return map.containsKey(key) ? map.get(key) : defaultValue;\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$\n"
"public $value_type$ get$capitalized_name$ValueOrThrow(\n"
"public $value_type$ ${$get$capitalized_name$ValueOrThrow$}$(\n"
" $key_type$ key) {\n"
" $key_null_check$\n"
" java.util.Map<$boxed_key_type$, $boxed_value_type$> map =\n"
@@ -578,6 +614,7 @@ GenerateMapGetters(io::Printer* printer) const {
" }\n"
" return map.get(key);\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
}
} else {
printer->Print(
@@ -586,21 +623,25 @@ GenerateMapGetters(io::Printer* printer) const {
" * Use {@link #get$capitalized_name$Map()} instead.\n"
" */\n"
"@java.lang.Deprecated\n"
"public java.util.Map<$type_parameters$> get$capitalized_name$() {\n"
"public java.util.Map<$type_parameters$> "
"${$get$capitalized_name$$}$() {\n"
" return get$capitalized_name$Map();\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$\n"
"public java.util.Map<$type_parameters$> get$capitalized_name$Map() {\n"
"public java.util.Map<$type_parameters$> "
"${$get$capitalized_name$Map$}$() {\n"
" return internalGet$capitalized_name$().getMap();\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$\n"
"public $value_type$ get$capitalized_name$OrDefault(\n"
"public $value_type$ ${$get$capitalized_name$OrDefault$}$(\n"
" $key_type$ key,\n"
" $value_type$ defaultValue) {\n"
" $key_null_check$\n"
@@ -608,11 +649,12 @@ GenerateMapGetters(io::Printer* printer) const {
" internalGet$capitalized_name$().getMap();\n"
" return map.containsKey(key) ? map.get(key) : defaultValue;\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldDocComment(printer, descriptor_);
printer->Print(
variables_,
"$deprecation$\n"
"public $value_type$ get$capitalized_name$OrThrow(\n"
"public $value_type$ ${$get$capitalized_name$OrThrow$}$(\n"
" $key_type$ key) {\n"
" $key_null_check$\n"
" java.util.Map<$type_parameters$> map =\n"
@@ -622,6 +664,7 @@ GenerateMapGetters(io::Printer* printer) const {
" }\n"
" return map.get(key);\n"
"}\n");
printer->Annotate("{", "}", descriptor_);
}
}