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 05160767df..76d4847bf5 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 @@ -47,11 +47,11 @@ import com.google.protobuf.UnittestLite.TestEmptyMessageWithExtensionsLite import com.google.protobuf.copy import com.google.protobuf.foreignMessageLite import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.EvilNamesProto2 -import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.HardKeywordsAllTypes +import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.HardKeywordsAllTypesProto2 import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.Interface -import com.google.protobuf.kotlin.generator.HardKeywordsAllTypesKt +import com.google.protobuf.kotlin.generator.HardKeywordsAllTypesProto2Kt import com.google.protobuf.kotlin.generator.evilNamesProto2 -import com.google.protobuf.kotlin.generator.hardKeywordsAllTypes +import com.google.protobuf.kotlin.generator.hardKeywordsAllTypesProto2 import com.google.protobuf.kotlin.generator.interface_ import com.google.protobuf.optionalGroupExtensionLite import com.google.protobuf.repeatedGroupExtensionLite @@ -948,18 +948,18 @@ class Proto2LiteTest { @Test fun testHardKeywordGettersAndSetters() { - hardKeywordsAllTypes { + hardKeywordsAllTypesProto2 { as_ = 1 assertThat(as_).isEqualTo(1) in_ = "foo" assertThat(in_).isEqualTo("foo") - break_ = HardKeywordsAllTypes.NestedEnum.FOO - assertThat(break_).isEqualTo(HardKeywordsAllTypes.NestedEnum.FOO) + break_ = HardKeywordsAllTypesProto2.NestedEnum.FOO + assertThat(break_).isEqualTo(HardKeywordsAllTypesProto2.NestedEnum.FOO) - do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 } - assertThat(do_).isEqualTo(HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }) + do_ = HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 } + assertThat(do_).isEqualTo(HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 }) continue_[1] = 1 assertThat(continue_[1]).isEqualTo(1) @@ -970,34 +970,34 @@ class Proto2LiteTest { for_ += "foo" assertThat(for_).isEqualTo(listOf("foo")) - fun_ += HardKeywordsAllTypes.NestedEnum.FOO - assertThat(fun_).isEqualTo(listOf(HardKeywordsAllTypes.NestedEnum.FOO)) + fun_ += HardKeywordsAllTypesProto2.NestedEnum.FOO + assertThat(fun_).isEqualTo(listOf(HardKeywordsAllTypesProto2.NestedEnum.FOO)) - if_ += HardKeywordsAllTypesKt.nestedMessage { while_ = 1 } - assertThat(if_).isEqualTo(listOf(HardKeywordsAllTypesKt.nestedMessage { while_ = 1 })) + if_ += HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 } + assertThat(if_).isEqualTo(listOf(HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 })) } } @Test fun testHardKeywordHazzers() { - hardKeywordsAllTypes { + hardKeywordsAllTypesProto2 { as_ = 1 assertThat(hasAs_()).isTrue() in_ = "foo" assertThat(hasIn_()).isTrue() - break_ = HardKeywordsAllTypes.NestedEnum.FOO + break_ = HardKeywordsAllTypesProto2.NestedEnum.FOO assertThat(hasBreak_()).isTrue() - do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 } + do_ = HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 } assertThat(hasDo_()).isTrue() } } @Test fun testHardKeywordClears() { - hardKeywordsAllTypes { + hardKeywordsAllTypesProto2 { as_ = 1 clearAs_() assertThat(hasAs_()).isFalse() @@ -1006,11 +1006,11 @@ class Proto2LiteTest { clearIn_() assertThat(hasIn_()).isFalse() - break_ = HardKeywordsAllTypes.NestedEnum.FOO + break_ = HardKeywordsAllTypesProto2.NestedEnum.FOO clearBreak_() assertThat(hasBreak_()).isFalse() - do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 } + do_ = HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 } clearDo_() assertThat(hasDo_()).isFalse() } 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 368b56cbc0..ad7f242ee6 100644 --- a/java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt +++ b/java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt @@ -34,11 +34,11 @@ import com.google.common.truth.Truth.assertThat import com.google.protobuf.TestUtil import com.google.protobuf.TestUtil.toBytes import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.EvilNamesProto2 -import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.HardKeywordsAllTypes +import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.HardKeywordsAllTypesProto2 import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.Interface -import com.google.protobuf.kotlin.generator.HardKeywordsAllTypesKt +import com.google.protobuf.kotlin.generator.HardKeywordsAllTypesProto2Kt import com.google.protobuf.kotlin.generator.evilNamesProto2 -import com.google.protobuf.kotlin.generator.hardKeywordsAllTypes +import com.google.protobuf.kotlin.generator.hardKeywordsAllTypesProto2 import com.google.protobuf.kotlin.generator.interface_ import com.google.protobuf.test.UnittestImport.ImportEnum import com.google.protobuf.test.UnittestImport.ImportMessage @@ -940,18 +940,18 @@ class Proto2Test { @Test fun testHardKeywordGettersAndSetters() { - hardKeywordsAllTypes { + hardKeywordsAllTypesProto2 { as_ = 1 assertThat(as_).isEqualTo(1) in_ = "foo" assertThat(in_).isEqualTo("foo") - break_ = HardKeywordsAllTypes.NestedEnum.FOO - assertThat(break_).isEqualTo(HardKeywordsAllTypes.NestedEnum.FOO) + break_ = HardKeywordsAllTypesProto2.NestedEnum.FOO + assertThat(break_).isEqualTo(HardKeywordsAllTypesProto2.NestedEnum.FOO) - do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 } - assertThat(do_).isEqualTo(HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }) + do_ = HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 } + assertThat(do_).isEqualTo(HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 }) continue_[1] = 1 assertThat(continue_[1]).isEqualTo(1) @@ -962,34 +962,34 @@ class Proto2Test { for_ += "foo" assertThat(for_).isEqualTo(listOf("foo")) - fun_ += HardKeywordsAllTypes.NestedEnum.FOO - assertThat(fun_).isEqualTo(listOf(HardKeywordsAllTypes.NestedEnum.FOO)) + fun_ += HardKeywordsAllTypesProto2.NestedEnum.FOO + assertThat(fun_).isEqualTo(listOf(HardKeywordsAllTypesProto2.NestedEnum.FOO)) - if_ += HardKeywordsAllTypesKt.nestedMessage { while_ = 1 } - assertThat(if_).isEqualTo(listOf(HardKeywordsAllTypesKt.nestedMessage { while_ = 1 })) + if_ += HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 } + assertThat(if_).isEqualTo(listOf(HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 })) } } @Test fun testHardKeywordHazzers() { - hardKeywordsAllTypes { + hardKeywordsAllTypesProto2 { as_ = 1 assertThat(hasAs_()).isTrue() in_ = "foo" assertThat(hasIn_()).isTrue() - break_ = HardKeywordsAllTypes.NestedEnum.FOO + break_ = HardKeywordsAllTypesProto2.NestedEnum.FOO assertThat(hasBreak_()).isTrue() - do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 } + do_ = HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 } assertThat(hasDo_()).isTrue() } } @Test fun testHardKeywordClears() { - hardKeywordsAllTypes { + hardKeywordsAllTypesProto2 { as_ = 1 clearAs_() assertThat(hasAs_()).isFalse() @@ -998,11 +998,11 @@ class Proto2Test { clearIn_() assertThat(hasIn_()).isFalse() - break_ = HardKeywordsAllTypes.NestedEnum.FOO + break_ = HardKeywordsAllTypesProto2.NestedEnum.FOO clearBreak_() assertThat(hasBreak_()).isFalse() - do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 } + do_ = HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 } clearDo_() assertThat(hasDo_()).isFalse() } 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 f8adacb657..7b394da941 100644 --- a/java/kotlin/src/test/kotlin/com/google/protobuf/Proto3Test.kt +++ b/java/kotlin/src/test/kotlin/com/google/protobuf/Proto3Test.kt @@ -33,11 +33,11 @@ package com.google.protobuf.kotlin import com.google.common.truth.Truth.assertThat import com.google.protobuf.kotlin.generator.EvilNamesProto3OuterClass.Class import com.google.protobuf.kotlin.generator.EvilNamesProto3OuterClass.EvilNamesProto3 -import com.google.protobuf.kotlin.generator.EvilNamesProto3OuterClass.HardKeywordsAllTypes -import com.google.protobuf.kotlin.generator.HardKeywordsAllTypesKt +import com.google.protobuf.kotlin.generator.EvilNamesProto3OuterClass.HardKeywordsAllTypesProto3 +import com.google.protobuf.kotlin.generator.HardKeywordsAllTypesProto3Kt import com.google.protobuf.kotlin.generator.class_ import com.google.protobuf.kotlin.generator.evilNamesProto3 -import com.google.protobuf.kotlin.generator.hardKeywordsAllTypes +import com.google.protobuf.kotlin.generator.hardKeywordsAllTypesProto3 import proto3_unittest.TestAllTypesKt import proto3_unittest.TestAllTypesKt.nestedMessage import proto3_unittest.UnittestProto3.TestAllTypes @@ -280,18 +280,18 @@ class Proto3Test { @Test fun testHardKeywordGettersAndSetters() { - hardKeywordsAllTypes { + hardKeywordsAllTypesProto3 { as_ = 1 assertThat(as_).isEqualTo(1) in_ = "foo" assertThat(in_).isEqualTo("foo") - break_ = HardKeywordsAllTypes.NestedEnum.FOO - assertThat(break_).isEqualTo(HardKeywordsAllTypes.NestedEnum.FOO) + break_ = HardKeywordsAllTypesProto3.NestedEnum.FOO + assertThat(break_).isEqualTo(HardKeywordsAllTypesProto3.NestedEnum.FOO) - do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 } - assertThat(do_).isEqualTo(HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }) + do_ = HardKeywordsAllTypesProto3Kt.nestedMessage { while_ = 1 } + assertThat(do_).isEqualTo(HardKeywordsAllTypesProto3Kt.nestedMessage { while_ = 1 }) continue_[1] = 1 assertThat(continue_[1]).isEqualTo(1) @@ -302,34 +302,34 @@ class Proto3Test { for_ += "foo" assertThat(for_).isEqualTo(listOf("foo")) - fun_ += HardKeywordsAllTypes.NestedEnum.FOO - assertThat(fun_).isEqualTo(listOf(HardKeywordsAllTypes.NestedEnum.FOO)) + fun_ += HardKeywordsAllTypesProto3.NestedEnum.FOO + assertThat(fun_).isEqualTo(listOf(HardKeywordsAllTypesProto3.NestedEnum.FOO)) - if_ += HardKeywordsAllTypesKt.nestedMessage { while_ = 1 } - assertThat(if_).isEqualTo(listOf(HardKeywordsAllTypesKt.nestedMessage { while_ = 1 })) + if_ += HardKeywordsAllTypesProto3Kt.nestedMessage { while_ = 1 } + assertThat(if_).isEqualTo(listOf(HardKeywordsAllTypesProto3Kt.nestedMessage { while_ = 1 })) } } @Test fun testHardKeywordHazzers() { - hardKeywordsAllTypes { + hardKeywordsAllTypesProto3 { as_ = 1 assertThat(hasAs_()).isTrue() in_ = "foo" assertThat(hasIn_()).isTrue() - break_ = HardKeywordsAllTypes.NestedEnum.FOO + break_ = HardKeywordsAllTypesProto3.NestedEnum.FOO assertThat(hasBreak_()).isTrue() - do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 } + do_ = HardKeywordsAllTypesProto3Kt.nestedMessage { while_ = 1 } assertThat(hasDo_()).isTrue() } } @Test fun testHardKeywordClears() { - hardKeywordsAllTypes { + hardKeywordsAllTypesProto3 { as_ = 1 clearAs_() assertThat(hasAs_()).isFalse() @@ -338,11 +338,11 @@ class Proto3Test { clearIn_() assertThat(hasIn_()).isFalse() - break_ = HardKeywordsAllTypes.NestedEnum.FOO + break_ = HardKeywordsAllTypesProto3.NestedEnum.FOO clearBreak_() assertThat(hasBreak_()).isFalse() - do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 } + do_ = HardKeywordsAllTypesProto3Kt.nestedMessage { while_ = 1 } clearDo_() assertThat(hasDo_()).isFalse() } diff --git a/java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto2.proto b/java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto2.proto index 552fd6485d..3735baf9f6 100644 --- a/java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto2.proto +++ b/java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto2.proto @@ -68,7 +68,7 @@ message EvilNamesProto2 { optional string by = 25; } -message HardKeywordsAllTypes { +message HardKeywordsAllTypesProto2 { message NestedMessage { optional int32 while = 1; } diff --git a/java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto3.proto b/java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto3.proto index 8990d0c388..f6b06d3727 100644 --- a/java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto3.proto +++ b/java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto3.proto @@ -81,7 +81,7 @@ message EvilNamesProto3 { } } -message HardKeywordsAllTypes { +message HardKeywordsAllTypesProto3 { message NestedMessage { optional int32 while = 1; } diff --git a/java/kotlin/src/test/proto/com/google/protobuf/example_extensible_message.proto b/java/kotlin/src/test/proto/com/google/protobuf/example_extensible_message.proto index 14f18dbdb1..b82c82b032 100644 --- a/java/kotlin/src/test/proto/com/google/protobuf/example_extensible_message.proto +++ b/java/kotlin/src/test/proto/com/google/protobuf/example_extensible_message.proto @@ -1,8 +1,38 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + syntax = "proto2"; -package example_extensible_message; +package protobuf.kotlin.test; -option java_package = "example_extensible_message"; +option java_package = "com.google.protobuf.kotlin.test"; option java_multiple_files = true; message ExampleExtensibleMessage { diff --git a/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc b/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc index 31fe5a6841..60619f1076 100644 --- a/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc +++ b/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc @@ -137,14 +137,10 @@ TEST(BootstrapTest, GeneratedFilesMatch) { // of the data to compare to. std::map vpath_map; std::map rpath_map; - rpath_map - ["third_party/protobuf_legacy_opensource/src/google/protobuf/" - "test_messages_proto2"] = - "net/proto2/z_generated_example/test_messages_proto2"; - rpath_map - ["third_party/protobuf_legacy_opensource/src/google/protobuf/" - "test_messages_proto3"] = - "net/proto2/z_generated_example/test_messages_proto3"; + rpath_map["third_party/protobuf/src/google/protobuf/test_messages_proto2"] = + "net/proto2/z_generated_example/test_messages_proto2"; + rpath_map["third_party/protobuf/src/google/protobuf/test_messages_proto3"] = + "net/proto2/z_generated_example/test_messages_proto3"; rpath_map["net/proto2/internal/proto2_weak"] = "net/proto2/z_generated_example/proto2_weak"; diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.h b/src/google/protobuf/compiler/cpp/cpp_helpers.h index 8d6385865a..d15ac29def 100644 --- a/src/google/protobuf/compiler/cpp/cpp_helpers.h +++ b/src/google/protobuf/compiler/cpp/cpp_helpers.h @@ -866,9 +866,7 @@ inline OneOfRangeImpl OneOfRange(const Descriptor* desc) { return {desc}; } PROTOC_EXPORT std::string StripProto(const std::string& filename); -inline bool EnableMessageOwnedArena(const Descriptor* desc) { - return false; -} +inline bool EnableMessageOwnedArena(const Descriptor* desc) { return false; } } // namespace cpp } // namespace compiler