Fix python and kotlin tests
diff --git a/CHANGES.txt b/CHANGES.txt index 4054f35..6a1e8b9 100644 --- a/CHANGES.txt +++ b/CHANGES.txt
@@ -23,7 +23,6 @@ * Fix initialization bug in doc comment line numbers Kotlin - * Enhancements to Kotlin support for Any protobuf. * Add orNull extensions for optional message fields in Kotlin. Python
diff --git a/python/google/protobuf/internal/json_format_test.py b/python/google/protobuf/internal/json_format_test.py index be33be1..cb533c1 100644 --- a/python/google/protobuf/internal/json_format_test.py +++ b/python/google/protobuf/internal/json_format_test.py
@@ -1049,14 +1049,8 @@ def testInvalidTimestamp(self): message = json_format_proto3_pb2.TestTimestamp() text = '{"value": "10000-01-01T00:00:00.00Z"}' -<<<<<<< HEAD - self.assertRaisesRegex( - json_format.ParseError, - 'Failed to parse value field: ' -======= self.assertRaisesRegexp( json_format.ParseError, 'Failed to parse value field: ' ->>>>>>> refs/tags/sync-piper 'time data \'10000-01-01T00:00:00\' does not match' ' format \'%Y-%m-%dT%H:%M:%S\' at TestTimestamp.value.', json_format.Parse, text, message) @@ -1095,16 +1089,9 @@ def testInvalidOneof(self): message = json_format_proto3_pb2.TestOneof() text = '{"oneofInt32Value": 1, "oneofStringValue": "2"}' -<<<<<<< HEAD - self.assertRaisesRegex( - json_format.ParseError, - 'Message type "proto3.TestOneof"' - ' should not have multiple "oneof_value" oneof fields.', -======= self.assertRaisesRegexp( json_format.ParseError, 'Message type "proto3.TestOneof"' ' should not have multiple "oneof_value" oneof fields at "TestOneof".', ->>>>>>> refs/tags/sync-piper json_format.Parse, text, message) def testInvalidListValue(self): @@ -1167,18 +1154,6 @@ 'value', json_format.Parse, text, message) text = '{"value": 1234}' -<<<<<<< HEAD - self.assertRaisesRegex( - json_format.ParseError, - '@type is missing when parsing any message.', - json_format.Parse, text, message) - text = '{"@type": "type.googleapis.com/MessageNotExist", "value": 1234}' - self.assertRaisesRegex( - TypeError, - 'Can not find message descriptor by type_url: ' - 'type.googleapis.com/MessageNotExist.', - json_format.Parse, text, message) -======= self.assertRaisesRegex(json_format.ParseError, '@type is missing when parsing any message at Any', json_format.Parse, text, message) @@ -1187,7 +1162,6 @@ json_format.ParseError, 'Can not find message descriptor by type_url: ' 'type.googleapis.com/MessageNotExist at Any', json_format.Parse, text, message) ->>>>>>> refs/tags/sync-piper # Only last part is to be used: b/25630112 text = (r'{"@type": "incorrect.googleapis.com/google.protobuf.Int32Value",' r'"value": 1234}')
diff --git a/src/google/protobuf/compiler/java/java_message.cc b/src/google/protobuf/compiler/java/java_message.cc index b2a236f..7fbad3f 100644 --- a/src/google/protobuf/compiler/java/java_message.cc +++ b/src/google/protobuf/compiler/java/java_message.cc
@@ -1526,7 +1526,7 @@ printer->Print( "@Suppress(\"UNCHECKED_CAST\")\n" "@kotlin.jvm.JvmSynthetic\n" - "public operator fun <T : Any> get(extension: " + "public operator fun <T> get(extension: " "com.google.protobuf.ExtensionLite<$message$, T>): T {\n" " return if (extension.isRepeated) {\n" " get(extension as com.google.protobuf.ExtensionLite<$message$, " @@ -1542,7 +1542,7 @@ "@kotlin.OptIn" "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" "@kotlin.jvm.JvmName(\"-getRepeatedExtension\")\n" - "public operator fun <E : Any> get(\n" + "public operator fun <E> get(\n" " extension: com.google.protobuf.ExtensionLite<$message$, List<E>>\n" "): com.google.protobuf.kotlin.ExtensionList<E, $message$> {\n" " return com.google.protobuf.kotlin.ExtensionList(extension, " @@ -1571,7 +1571,7 @@ printer->Print( "@kotlin.jvm.JvmSynthetic\n" "@kotlin.PublishedApi\n" - "internal fun <T : Any> setExtension(extension: " + "internal fun <T> setExtension(extension: " "com.google.protobuf.ExtensionLite<$message$, T>, " "value: T) {\n" " _builder.setExtension(extension, value)\n" @@ -1614,7 +1614,7 @@ printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "public fun <E : Any> com.google.protobuf.kotlin.ExtensionList<E, " + "public fun <E> com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.add(value: E) {\n" " _builder.addExtension(this.extension, value)\n" "}\n\n", @@ -1623,7 +1623,7 @@ printer->Print( "@kotlin.jvm.JvmSynthetic\n" "@Suppress(\"NOTHING_TO_INLINE\")\n" - "public inline operator fun <E : Any> " + "public inline operator fun <E> " "com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.plusAssign" "(value: E) {\n" @@ -1633,7 +1633,7 @@ printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "public fun <E : Any> com.google.protobuf.kotlin.ExtensionList<E, " + "public fun <E> com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.addAll(values: Iterable<E>) {\n" " for (value in values) {\n" " add(value)\n" @@ -1644,7 +1644,7 @@ printer->Print( "@kotlin.jvm.JvmSynthetic\n" "@Suppress(\"NOTHING_TO_INLINE\")\n" - "public inline operator fun <E : Any> " + "public inline operator fun <E> " "com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.plusAssign(values: " "Iterable<E>) {\n" @@ -1654,7 +1654,7 @@ printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "public operator fun <E : Any> " + "public operator fun <E> " "com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.set(index: Int, value: " "E) {\n"
diff --git a/src/google/protobuf/compiler/java/java_message_lite.cc b/src/google/protobuf/compiler/java/java_message_lite.cc index dd32c26..5be4b6b 100644 --- a/src/google/protobuf/compiler/java/java_message_lite.cc +++ b/src/google/protobuf/compiler/java/java_message_lite.cc
@@ -847,7 +847,7 @@ printer->Print( "@Suppress(\"UNCHECKED_CAST\")\n" "@kotlin.jvm.JvmSynthetic\n" - "public operator fun <T : Any> get(extension: " + "public operator fun <T> get(extension: " "com.google.protobuf.ExtensionLite<$message$, T>): T {\n" " return if (extension.isRepeated) {\n" " get(extension as com.google.protobuf.ExtensionLite<$message$, " @@ -863,7 +863,7 @@ "@kotlin.OptIn" "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" "@kotlin.jvm.JvmName(\"-getRepeatedExtension\")\n" - "public operator fun <E : Any> get(\n" + "public operator fun <E> get(\n" " extension: com.google.protobuf.ExtensionLite<$message$, List<E>>\n" "): com.google.protobuf.kotlin.ExtensionList<E, $message$> {\n" " return com.google.protobuf.kotlin.ExtensionList(extension, " @@ -892,7 +892,7 @@ printer->Print( "@kotlin.jvm.JvmSynthetic\n" "@kotlin.PublishedApi\n" - "internal fun <T : Any> setExtension(extension: " + "internal fun <T> setExtension(extension: " "com.google.protobuf.ExtensionLite<$message$, T>, " "value: T) {\n" " _builder.setExtension(extension, value)\n" @@ -935,7 +935,7 @@ printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "public fun<E : Any> com.google.protobuf.kotlin.ExtensionList<E, " + "public fun<E> com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.add(value: E) {\n" " _builder.addExtension(this.extension, value)\n" "}\n\n", @@ -944,7 +944,7 @@ printer->Print( "@kotlin.jvm.JvmSynthetic\n" "@Suppress(\"NOTHING_TO_INLINE\")\n" - "public inline operator fun <E : Any> " + "public inline operator fun <E> " "com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.plusAssign" "(value: E) {\n" @@ -954,7 +954,7 @@ printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "public fun<E : Any> com.google.protobuf.kotlin.ExtensionList<E, " + "public fun<E> com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.addAll(values: Iterable<E>) {\n" " for (value in values) {\n" " add(value)\n" @@ -965,7 +965,7 @@ printer->Print( "@kotlin.jvm.JvmSynthetic\n" "@Suppress(\"NOTHING_TO_INLINE\")\n" - "public inline operator fun <E : Any> " + "public inline operator fun <E> " "com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.plusAssign(values: " "Iterable<E>) {\n" @@ -975,7 +975,7 @@ printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "public operator fun <E : Any> " + "public operator fun <E> " "com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.set(index: Int, value: " "E) {\n"