diff --git a/java/kotlin-lite/src/main/kotlin/com/google/protobuf/ExtendableMessageLiteExtensions.kt b/java/kotlin-lite/src/main/kotlin/com/google/protobuf/ExtendableMessageLiteExtensions.kt index 714c81ecc3..8247db4609 100644 --- a/java/kotlin-lite/src/main/kotlin/com/google/protobuf/ExtendableMessageLiteExtensions.kt +++ b/java/kotlin-lite/src/main/kotlin/com/google/protobuf/ExtendableMessageLiteExtensions.kt @@ -37,19 +37,20 @@ import com.google.protobuf.GeneratedMessageLite operator fun < M : GeneratedMessageLite.ExtendableMessage, MOrBT : GeneratedMessageLite.ExtendableMessageOrBuilder, - T : Any> MOrBT.get(extension: ExtensionLite): T = getExtension(extension) + T : Any, +> MOrBT.get(extension: ExtensionLite): T = getExtension(extension) /** Sets the current value of the proto extension in this builder. */ operator fun < M : GeneratedMessageLite.ExtendableMessage, B : GeneratedMessageLite.ExtendableBuilder, - T : Any> B.set(extension: ExtensionLite, value: T) { + T : Any, +> B.set(extension: ExtensionLite, value: T) { setExtension(extension, value) } /** Returns true if the specified extension is set. */ operator fun < M : GeneratedMessageLite.ExtendableMessage, - MorBT : GeneratedMessageLite.ExtendableMessageOrBuilder> MorBT.contains( - extension: ExtensionLite -): Boolean = hasExtension(extension) + MorBT : GeneratedMessageLite.ExtendableMessageOrBuilder, +> MorBT.contains(extension: ExtensionLite): Boolean = hasExtension(extension) diff --git a/java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt b/java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt index bf292608b1..7937a3df2e 100644 --- a/java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt +++ b/java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt @@ -155,7 +155,7 @@ class Proto2LiteTest { .isEqualTo(TestUtilLite.getAllLiteSetBuilder().build()) } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testGetters() { testAllTypesLite { @@ -176,7 +176,7 @@ class Proto2LiteTest { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testDefaultGetters() { testAllTypesLite { @@ -187,7 +187,7 @@ class Proto2LiteTest { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testRepeatedGettersAndSetters() { testAllTypesLite { @@ -208,20 +208,20 @@ class Proto2LiteTest { repeatedGroup.addAll( listOf( TestAllTypesLiteKt.repeatedGroup { a = 1 }, - TestAllTypesLiteKt.repeatedGroup { a = 2 } + TestAllTypesLiteKt.repeatedGroup { a = 2 }, ) ) assertThat(repeatedGroup) .isEqualTo( listOf( TestAllTypesLiteKt.repeatedGroup { a = 1 }, - TestAllTypesLiteKt.repeatedGroup { a = 2 } + TestAllTypesLiteKt.repeatedGroup { a = 2 }, ) ) repeatedGroup += listOf( TestAllTypesLiteKt.repeatedGroup { a = 3 }, - TestAllTypesLiteKt.repeatedGroup { a = 4 } + TestAllTypesLiteKt.repeatedGroup { a = 4 }, ) assertThat(repeatedGroup) .isEqualTo( @@ -229,7 +229,7 @@ class Proto2LiteTest { TestAllTypesLiteKt.repeatedGroup { a = 1 }, TestAllTypesLiteKt.repeatedGroup { a = 2 }, TestAllTypesLiteKt.repeatedGroup { a = 3 }, - TestAllTypesLiteKt.repeatedGroup { a = 4 } + TestAllTypesLiteKt.repeatedGroup { a = 4 }, ) ) repeatedGroup[0] = TestAllTypesLiteKt.repeatedGroup { a = 5 } @@ -239,7 +239,7 @@ class Proto2LiteTest { TestAllTypesLiteKt.repeatedGroup { a = 5 }, TestAllTypesLiteKt.repeatedGroup { a = 2 }, TestAllTypesLiteKt.repeatedGroup { a = 3 }, - TestAllTypesLiteKt.repeatedGroup { a = 4 } + TestAllTypesLiteKt.repeatedGroup { a = 4 }, ) ) @@ -253,7 +253,7 @@ class Proto2LiteTest { nestedMessage { bb = 1 }, nestedMessage { bb = 2 }, nestedMessage { bb = 3 }, - nestedMessage { bb = 4 } + nestedMessage { bb = 4 }, ) ) repeatedNestedMessage[0] = nestedMessage { bb = 5 } @@ -263,7 +263,7 @@ class Proto2LiteTest { nestedMessage { bb = 5 }, nestedMessage { bb = 2 }, nestedMessage { bb = 3 }, - nestedMessage { bb = 4 } + nestedMessage { bb = 4 }, ) ) @@ -278,7 +278,7 @@ class Proto2LiteTest { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testHazzers() { testAllTypesLite { @@ -309,7 +309,7 @@ class Proto2LiteTest { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testClears() { testAllTypesLite { @@ -398,36 +398,36 @@ class Proto2LiteTest { setExtension(UnittestLite.optionalBytesExtensionLite, toBytes("116")) setExtension( UnittestLite.optionalGroupExtensionLite, - optionalGroupExtensionLite { a = 117 } + optionalGroupExtensionLite { a = 117 }, ) setExtension( UnittestLite.optionalNestedMessageExtensionLite, - TestAllTypesLiteKt.nestedMessage { bb = 118 } + TestAllTypesLiteKt.nestedMessage { bb = 118 }, ) setExtension( UnittestLite.optionalForeignMessageExtensionLite, - foreignMessageLite { c = 119 } + foreignMessageLite { c = 119 }, ) setExtension( UnittestLite.optionalImportMessageExtensionLite, - ImportMessageLite.newBuilder().setD(120).build() + ImportMessageLite.newBuilder().setD(120).build(), ) setExtension( UnittestLite.optionalPublicImportMessageExtensionLite, - PublicImportMessageLite.newBuilder().setE(126).build() + PublicImportMessageLite.newBuilder().setE(126).build(), ) setExtension( UnittestLite.optionalLazyMessageExtensionLite, - TestAllTypesLiteKt.nestedMessage { bb = 127 } + TestAllTypesLiteKt.nestedMessage { bb = 127 }, ) setExtension( UnittestLite.optionalUnverifiedLazyMessageExtensionLite, - TestAllTypesLiteKt.nestedMessage { bb = 128 } + TestAllTypesLiteKt.nestedMessage { bb = 128 }, ) setExtension(UnittestLite.optionalNestedEnumExtensionLite, NestedEnum.BAZ) setExtension( UnittestLite.optionalForeignEnumExtensionLite, - ForeignEnumLite.FOREIGN_LITE_BAZ + ForeignEnumLite.FOREIGN_LITE_BAZ, ) setExtension(UnittestLite.optionalImportEnumExtensionLite, ImportEnumLite.IMPORT_LITE_BAZ) setExtension(UnittestLite.optionalStringPieceExtensionLite, "124") @@ -521,7 +521,7 @@ class Proto2LiteTest { .isEqualTo(TestUtilLite.getAllLiteExtensionsSet()) } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testExtensionGetters() { testAllExtensionsLite { @@ -545,7 +545,7 @@ class Proto2LiteTest { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testRepeatedExtensionGettersAndSetters() { testAllExtensionsLite { @@ -580,7 +580,7 @@ class Proto2LiteTest { repeatedGroupExtensionLite { a = 1 }, repeatedGroupExtensionLite { a = 2 }, repeatedGroupExtensionLite { a = 3 }, - repeatedGroupExtensionLite { a = 4 } + repeatedGroupExtensionLite { a = 4 }, ) ) this[UnittestLite.repeatedGroupExtensionLite][0] = repeatedGroupExtensionLite { a = 5 } @@ -590,7 +590,7 @@ class Proto2LiteTest { repeatedGroupExtensionLite { a = 5 }, repeatedGroupExtensionLite { a = 2 }, repeatedGroupExtensionLite { a = 3 }, - repeatedGroupExtensionLite { a = 4 } + repeatedGroupExtensionLite { a = 4 }, ) ) @@ -607,7 +607,7 @@ class Proto2LiteTest { nestedMessage { bb = 1 }, nestedMessage { bb = 2 }, nestedMessage { bb = 3 }, - nestedMessage { bb = 4 } + nestedMessage { bb = 4 }, ) ) this[UnittestLite.repeatedNestedMessageExtensionLite][0] = nestedMessage { bb = 5 } @@ -617,7 +617,7 @@ class Proto2LiteTest { nestedMessage { bb = 5 }, nestedMessage { bb = 2 }, nestedMessage { bb = 3 }, - nestedMessage { bb = 4 } + nestedMessage { bb = 4 }, ) ) @@ -635,7 +635,7 @@ class Proto2LiteTest { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testExtensionContains() { testAllExtensionsLite { @@ -667,7 +667,7 @@ class Proto2LiteTest { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testExtensionClears() { testAllExtensionsLite { @@ -756,7 +756,7 @@ class Proto2LiteTest { ) } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testMapGettersAndSetters() { testMapLite { @@ -788,7 +788,7 @@ class Proto2LiteTest { 1 to MapEnumLite.MAP_ENUM_FOO_LITE, 2 to MapEnumLite.MAP_ENUM_BAR_LITE, 3 to MapEnumLite.MAP_ENUM_BAZ_LITE, - 4 to MapEnumLite.MAP_ENUM_FOO_LITE + 4 to MapEnumLite.MAP_ENUM_FOO_LITE, ) ) @@ -806,13 +806,13 @@ class Proto2LiteTest { 1 to foreignMessageLite { c = 1 }, 2 to foreignMessageLite { c = 2 }, 3 to foreignMessageLite { c = 3 }, - 4 to foreignMessageLite { c = 4 } + 4 to foreignMessageLite { c = 4 }, ) ) } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testMapRemove() { testMapLite { @@ -838,7 +838,7 @@ class Proto2LiteTest { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testMapClear() { testMapLite { @@ -920,7 +920,7 @@ class Proto2LiteTest { assertThat(interface_ {}).isEqualTo(Interface.newBuilder().build()) } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testHardKeywordGettersAndSetters() { hardKeywordsAllTypesProto2 { @@ -950,7 +950,7 @@ class Proto2LiteTest { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testHardKeywordHazzers() { hardKeywordsAllTypesProto2 { @@ -965,7 +965,7 @@ class Proto2LiteTest { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testHardKeywordClears() { hardKeywordsAllTypesProto2 { diff --git a/java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageExtensions.kt b/java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageExtensions.kt index 9f62a3f7e4..0b09a408bd 100644 --- a/java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageExtensions.kt +++ b/java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageExtensions.kt @@ -37,7 +37,8 @@ import com.google.protobuf.GeneratedMessage operator fun < M : GeneratedMessage.ExtendableMessage, B : GeneratedMessage.ExtendableBuilder, - T : Any> B.set(extension: ExtensionLite, value: T) { + T : Any, +> B.set(extension: ExtensionLite, value: T) { setExtension(extension, value) } @@ -45,11 +46,11 @@ operator fun < operator fun < M : GeneratedMessage.ExtendableMessage, MorBT : GeneratedMessage.ExtendableMessageOrBuilder, - T : Any> MorBT.get(extension: ExtensionLite): T = getExtension(extension) + T : Any, +> MorBT.get(extension: ExtensionLite): T = getExtension(extension) /** Returns true if the specified extension is set on this builder. */ operator fun < M : GeneratedMessage.ExtendableMessage, - MorBT : GeneratedMessage.ExtendableMessageOrBuilder> MorBT.contains( - extension: ExtensionLite -): Boolean = hasExtension(extension) + MorBT : GeneratedMessage.ExtendableMessageOrBuilder, +> MorBT.contains(extension: ExtensionLite): Boolean = hasExtension(extension) diff --git a/java/kotlin/src/main/kotlin/com/google/protobuf/OnlyForUseByGeneratedProtoCode.kt b/java/kotlin/src/main/kotlin/com/google/protobuf/OnlyForUseByGeneratedProtoCode.kt index a1cb808b72..3cb8799b8d 100644 --- a/java/kotlin/src/main/kotlin/com/google/protobuf/OnlyForUseByGeneratedProtoCode.kt +++ b/java/kotlin/src/main/kotlin/com/google/protobuf/OnlyForUseByGeneratedProtoCode.kt @@ -41,7 +41,7 @@ package com.google.protobuf.kotlin This API is only intended for use by generated protobuf code, the code generator, and their own tests. If this does not describe your code, you should not be using this API. """, - level = RequiresOptIn.Level.ERROR + level = RequiresOptIn.Level.ERROR, ) @Retention(AnnotationRetention.BINARY) @Target(AnnotationTarget.CONSTRUCTOR, AnnotationTarget.ANNOTATION_CLASS) diff --git a/java/kotlin/src/test/kotlin/com/google/protobuf/DslListTest.kt b/java/kotlin/src/test/kotlin/com/google/protobuf/DslListTest.kt index 556d618c99..7af33e45a5 100644 --- a/java/kotlin/src/test/kotlin/com/google/protobuf/DslListTest.kt +++ b/java/kotlin/src/test/kotlin/com/google/protobuf/DslListTest.kt @@ -90,7 +90,7 @@ class DslListTest { .addEqualityGroup( DslList(emptyList()), DslList(emptyList()), - emptyList() + emptyList(), ) .testEquals() } diff --git a/java/kotlin/src/test/kotlin/com/google/protobuf/DslMapTest.kt b/java/kotlin/src/test/kotlin/com/google/protobuf/DslMapTest.kt index 5e75a8790f..f3e6e394b1 100644 --- a/java/kotlin/src/test/kotlin/com/google/protobuf/DslMapTest.kt +++ b/java/kotlin/src/test/kotlin/com/google/protobuf/DslMapTest.kt @@ -147,7 +147,7 @@ class DslMapTest { .addEqualityGroup( DslMap(emptyMap()), DslMap(emptyMap()), - emptyMap() + emptyMap(), ) .testEquals() } diff --git a/java/kotlin/src/test/kotlin/com/google/protobuf/ExtensionListTest.kt b/java/kotlin/src/test/kotlin/com/google/protobuf/ExtensionListTest.kt index 9cd60dfd94..21dec416fe 100644 --- a/java/kotlin/src/test/kotlin/com/google/protobuf/ExtensionListTest.kt +++ b/java/kotlin/src/test/kotlin/com/google/protobuf/ExtensionListTest.kt @@ -45,7 +45,7 @@ class ExtensionListTest { val extensionList = ExtensionList( TestProto.repeatedExtension, - mutableListOf(1, 2, 3) + mutableListOf(1, 2, 3), ) assertThat(extensionList is MutableList<*>).isFalse() } @@ -56,7 +56,7 @@ class ExtensionListTest { val extensionList = ExtensionList( TestProto.repeatedExtension, - mutableListOf(1, 2, 3) + mutableListOf(1, 2, 3), ) val extensionListAsJavaUtil = extensionList as java.util.List assertFailsWith { extensionListAsJavaUtil.add(4) } @@ -68,7 +68,7 @@ class ExtensionListTest { val extensionList = ExtensionList( TestProto.repeatedExtension, - mutableListOf(1, 2, 3) + mutableListOf(1, 2, 3), ) val iterator = extensionList.iterator() as java.util.Iterator iterator.next() @@ -82,7 +82,7 @@ class ExtensionListTest { val extensionList = ExtensionList( TestProto.repeatedExtension, - mutableListOf(1, 2, 3) + mutableListOf(1, 2, 3), ) val iterator = extensionList.listIterator() as java.util.ListIterator iterator.next() @@ -96,7 +96,7 @@ class ExtensionListTest { val extensionList = ExtensionList( TestProto.repeatedExtension, - mutableListOf(1, 2, 3) + mutableListOf(1, 2, 3), ) val iterator = extensionList.listIterator(1) as java.util.ListIterator iterator.next() @@ -119,15 +119,15 @@ class ExtensionListTest { .addEqualityGroup( ExtensionList(TestProto.repeatedExtension, listOf(1, 2)), ExtensionList(TestProto.differentExtension, listOf(1, 2)), - listOf(1, 2) + listOf(1, 2), ) .addEqualityGroup( ExtensionList(TestProto.repeatedExtension, listOf(2, 2)), - listOf(2, 2) + listOf(2, 2), ) .addEqualityGroup( ExtensionList(TestProto.repeatedExtension, emptyList()), - emptyList() + emptyList(), ) .testEquals() } diff --git a/java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt b/java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt index 754a3294cc..1d8cf054f2 100644 --- a/java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt +++ b/java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt @@ -162,7 +162,7 @@ class Proto2Test { .isEqualTo(TestUtil.getAllSetBuilder().build()) } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testGetters() { testAllTypes { @@ -183,7 +183,7 @@ class Proto2Test { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testDefaultGetters() { testAllTypes { @@ -194,7 +194,7 @@ class Proto2Test { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testRepeatedGettersAndSetters() { testAllTypes { @@ -276,7 +276,7 @@ class Proto2Test { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testHazzers() { testAllTypes { @@ -307,7 +307,7 @@ class Proto2Test { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testClears() { testAllTypes { @@ -496,7 +496,7 @@ class Proto2Test { .isEqualTo(TestUtil.getAllExtensionsSet()) } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testExtensionGetters() { testAllExtensions { @@ -519,7 +519,7 @@ class Proto2Test { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testRepeatedExtensionGettersAndSetters() { testAllExtensions { @@ -600,7 +600,7 @@ class Proto2Test { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testExtensionContains() { testAllExtensions { @@ -631,7 +631,7 @@ class Proto2Test { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testExtensionClears() { testAllExtensions { @@ -713,7 +713,7 @@ class Proto2Test { ) } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testMapGettersAndSetters() { val intMap = testIntIntMap { @@ -765,7 +765,7 @@ class Proto2Test { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testMapRemove() { val intMap = testIntIntMap { @@ -793,7 +793,7 @@ class Proto2Test { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testMapClear() { val intMap = testIntIntMap { @@ -887,7 +887,7 @@ class Proto2Test { assertThat(interface_ {}).isEqualTo(Interface.newBuilder().build()) } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testHardKeywordGettersAndSetters() { hardKeywordsAllTypesProto2 { @@ -917,7 +917,7 @@ class Proto2Test { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testHardKeywordHazzers() { hardKeywordsAllTypesProto2 { @@ -932,7 +932,7 @@ class Proto2Test { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testHardKeywordClears() { hardKeywordsAllTypesProto2 { diff --git a/java/kotlin/src/test/kotlin/com/google/protobuf/Proto3Test.kt b/java/kotlin/src/test/kotlin/com/google/protobuf/Proto3Test.kt index 72ab8e1f80..8f8cd80492 100644 --- a/java/kotlin/src/test/kotlin/com/google/protobuf/Proto3Test.kt +++ b/java/kotlin/src/test/kotlin/com/google/protobuf/Proto3Test.kt @@ -31,7 +31,7 @@ import org.junit.runners.JUnit4 @RunWith(JUnit4::class) class Proto3Test { - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testGettersAndSetters() { testAllTypes { @@ -53,7 +53,7 @@ class Proto3Test { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testRepeatedGettersAndSetters() { testAllTypes { @@ -253,7 +253,7 @@ class Proto3Test { assertThat(class_ {}).isEqualTo(Class.newBuilder().build()) } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testHardKeywordGettersAndSetters() { hardKeywordsAllTypesProto3 { @@ -286,7 +286,7 @@ class Proto3Test { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testHardKeywordHazzers() { hardKeywordsAllTypesProto3 { @@ -304,7 +304,7 @@ class Proto3Test { } } - @Suppress("CheckResult") + @Suppress("CheckReturnValue") @Test fun testHardKeywordClears() { hardKeywordsAllTypesProto3 { diff --git a/java/kotlin/src/test/proto/com/google/protobuf/multiple_files_proto3.proto b/java/kotlin/src/test/proto/com/google/protobuf/multiple_files_proto3.proto index a6d4eccd9e..3e5c64d888 100644 --- a/java/kotlin/src/test/proto/com/google/protobuf/multiple_files_proto3.proto +++ b/java/kotlin/src/test/proto/com/google/protobuf/multiple_files_proto3.proto @@ -12,7 +12,9 @@ package protobuf.kotlin.generator; option java_package = "com.google.protobuf.kotlin.generator"; option java_multiple_files = true; -enum NestedEnum { FOO = 0; } +enum NestedEnum { + FOO = 0; +} message MultipleFilesMessageA {}