diff options
Diffstat (limited to 'csharp/src/Google.Protobuf.Test')
9 files changed, 0 insertions, 769 deletions
diff --git a/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs b/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs index 46d3bd9a..c62ac046 100644 --- a/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs +++ b/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs @@ -45,53 +45,6 @@ namespace Google.Protobuf.Collections /// </summary> public class MapFieldTest { - // Protobuf-specific tests - [Test] - public void Freeze_FreezesMessages() - { - var message = new ForeignMessage { C = 20 }; - var map = new MapField<string, ForeignMessage> { { "x", message } }; - map.Freeze(); - Assert.IsTrue(message.IsFrozen); - } - - [Test] - public void Freeze_Idempotent() - { - var message = new ForeignMessage { C = 20 }; - var map = new MapField<string, ForeignMessage> { { "x", message } }; - Assert.IsFalse(map.IsFrozen); - map.Freeze(); - Assert.IsTrue(message.IsFrozen); - map.Freeze(); - Assert.IsTrue(message.IsFrozen); - } - - [Test] - public void Freeze_PreventsMutation() - { - var map = new MapField<string, string>(); - map.Freeze(); - Assert.IsTrue(map.IsFrozen); - Assert.IsTrue(map.IsReadOnly); - ICollection<KeyValuePair<string, string>> collection = map; - Assert.Throws<InvalidOperationException>(() => map["x"] = "y"); - Assert.Throws<InvalidOperationException>(() => map.Add("x", "y")); - Assert.Throws<InvalidOperationException>(() => map.Remove("x")); - Assert.Throws<InvalidOperationException>(() => map.Clear()); - Assert.Throws<InvalidOperationException>(() => collection.Add(NewKeyValuePair("x", "y"))); - Assert.Throws<InvalidOperationException>(() => collection.Remove(NewKeyValuePair("x", "y"))); - } - - [Test] - public void Clone_ReturnsNonFrozen() - { - var map = new MapField<string, string>(); - map.Freeze(); - var clone = map.Clone(); - clone.Add("x", "y"); - } - [Test] public void Clone_ClonesMessages() { @@ -422,10 +375,6 @@ namespace Google.Protobuf.Collections dictionary.Remove("x"); Assert.AreEqual(0, dictionary.Count); Assert.Throws<ArgumentNullException>(() => dictionary.Remove(null)); - - map.Freeze(); - // Call should fail even though it clearly doesn't contain 5 as a key. - Assert.Throws<InvalidOperationException>(() => dictionary.Remove(5)); } [Test] @@ -449,8 +398,6 @@ namespace Google.Protobuf.Collections var map = new MapField<string, string> { { "x", "y" } }; IDictionary dictionary = map; Assert.IsFalse(dictionary.IsFixedSize); - map.Freeze(); - Assert.IsTrue(dictionary.IsFixedSize); } [Test] @@ -504,9 +451,6 @@ namespace Google.Protobuf.Collections Assert.Throws<InvalidCastException>(() => dictionary["x"] = 5); Assert.Throws<ArgumentNullException>(() => dictionary[null] = "z"); Assert.Throws<ArgumentNullException>(() => dictionary["x"] = null); - map.Freeze(); - // Note: Not InvalidOperationException. - Assert.Throws<NotSupportedException>(() => dictionary["a"] = "c"); } [Test] diff --git a/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs b/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs index 25be7731..33c4e10c 100644 --- a/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs +++ b/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs @@ -194,43 +194,9 @@ namespace Google.Protobuf.Collections } [Test] - public void Freeze_FreezesElements() - { - var list = new RepeatedField<TestAllTypes> { new TestAllTypes() }; - Assert.IsFalse(list[0].IsFrozen); - list.Freeze(); - Assert.IsTrue(list[0].IsFrozen); - } - - [Test] - public void Freeze_PreventsMutations() - { - var list = new RepeatedField<int> { 0 }; - list.Freeze(); - Assert.Throws<InvalidOperationException>(() => list.Add(1)); - Assert.Throws<InvalidOperationException>(() => list[0] = 1); - Assert.Throws<InvalidOperationException>(() => list.Clear()); - Assert.Throws<InvalidOperationException>(() => list.RemoveAt(0)); - Assert.Throws<InvalidOperationException>(() => list.Remove(0)); - Assert.Throws<InvalidOperationException>(() => list.Insert(0, 0)); - } - - [Test] - public void Freeze_ReportsFrozen() - { - var list = new RepeatedField<int> { 0 }; - Assert.IsFalse(list.IsFrozen); - Assert.IsFalse(list.IsReadOnly); - list.Freeze(); - Assert.IsTrue(list.IsFrozen); - Assert.IsTrue(list.IsReadOnly); - } - - [Test] public void Clone_ReturnsMutable() { var list = new RepeatedField<int> { 0 }; - list.Freeze(); var clone = list.Clone(); clone[0] = 1; } @@ -585,8 +551,6 @@ namespace Google.Protobuf.Collections var field = new RepeatedField<string> { "first", "second" }; IList list = field; Assert.IsFalse(list.IsFixedSize); - field.Freeze(); - Assert.IsTrue(list.IsFixedSize); } [Test] diff --git a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs index 528a4023..dfaac48c 100644 --- a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs +++ b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs @@ -504,23 +504,6 @@ namespace Google.Protobuf }
[Test]
- public void Freeze()
- {
- var frozen = new TestAllTypes();
- frozen.Freeze();
- Assert.IsTrue(frozen.IsFrozen);
-
- Assert.Throws<InvalidOperationException>(() => frozen.ClearOneofField());
- Assert.Throws<InvalidOperationException>(() => frozen.SingleInt32 = 0);
- Assert.Throws<InvalidOperationException>(() => frozen.SingleNestedMessage = null);
- Assert.Throws<InvalidOperationException>(() => frozen.SingleNestedEnum = 0);
- Assert.Throws<InvalidOperationException>(() => frozen.OneofString = null);
- Assert.Throws<InvalidOperationException>(() => frozen.OneofUint32 = 0U);
- Assert.Throws<InvalidOperationException>(() => frozen.RepeatedDouble.Add(0.0));
- Assert.Throws<InvalidOperationException>(() => frozen.RepeatedNestedMessage.Add(new TestAllTypes.Types.NestedMessage()));
- }
-
- [Test]
public void OneofProperties()
{
// Switch the oneof case between each of the different options, and check everything behaves
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs index 7da82bf0..2c87943f 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs @@ -216,30 +216,6 @@ namespace Google.Protobuf.TestProtos { return new TestMap(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - mapInt32Int32_.Freeze(); - mapInt64Int64_.Freeze(); - mapUint32Uint32_.Freeze(); - mapUint64Uint64_.Freeze(); - mapSint32Sint32_.Freeze(); - mapSint64Sint64_.Freeze(); - mapFixed32Fixed32_.Freeze(); - mapFixed64Fixed64_.Freeze(); - mapSfixed32Sfixed32_.Freeze(); - mapSfixed64Sfixed64_.Freeze(); - mapInt32Float_.Freeze(); - mapInt32Double_.Freeze(); - mapBoolBool_.Freeze(); - mapStringString_.Freeze(); - mapInt32Bytes_.Freeze(); - mapInt32Enum_.Freeze(); - mapInt32ForeignMessage_.Freeze(); - } - public const int MapInt32Int32FieldNumber = 1; private static readonly pbc::MapField<int, int>.Codec _map_mapInt32Int32_codec = new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10); @@ -613,20 +589,11 @@ namespace Google.Protobuf.TestProtos { return new TestMapSubmessage(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - if (testMap_ != null) TestMap.Freeze(); - } - public const int TestMapFieldNumber = 1; private global::Google.Protobuf.TestProtos.TestMap testMap_; public global::Google.Protobuf.TestProtos.TestMap TestMap { get { return testMap_; } set { - pb::Freezable.CheckMutable(this); testMap_ = value; } } @@ -737,14 +704,6 @@ namespace Google.Protobuf.TestProtos { return new TestMessageMap(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - mapInt32Message_.Freeze(); - } - public const int MapInt32MessageFieldNumber = 1; private static readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.TestAllTypes>.Codec _map_mapInt32Message_codec = new pbc::MapField<int, global::Google.Protobuf.TestProtos.TestAllTypes>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.TestAllTypes.Parser), 10); @@ -847,15 +806,6 @@ namespace Google.Protobuf.TestProtos { return new TestSameTypeMap(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - map1_.Freeze(); - map2_.Freeze(); - } - public const int Map1FieldNumber = 1; private static readonly pbc::MapField<int, int>.Codec _map_map1_codec = new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10); @@ -988,28 +938,6 @@ namespace Google.Protobuf.TestProtos { return new TestArenaMap(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - mapInt32Int32_.Freeze(); - mapInt64Int64_.Freeze(); - mapUint32Uint32_.Freeze(); - mapUint64Uint64_.Freeze(); - mapSint32Sint32_.Freeze(); - mapSint64Sint64_.Freeze(); - mapFixed32Fixed32_.Freeze(); - mapFixed64Fixed64_.Freeze(); - mapSfixed32Sfixed32_.Freeze(); - mapSfixed64Sfixed64_.Freeze(); - mapInt32Float_.Freeze(); - mapInt32Double_.Freeze(); - mapBoolBool_.Freeze(); - mapInt32Enum_.Freeze(); - mapInt32ForeignMessage_.Freeze(); - } - public const int MapInt32Int32FieldNumber = 1; private static readonly pbc::MapField<int, int>.Codec _map_mapInt32Int32_codec = new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10); @@ -1349,14 +1277,6 @@ namespace Google.Protobuf.TestProtos { return new MessageContainingEnumCalledType(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - type_.Freeze(); - } - public const int TypeFieldNumber = 1; private static readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType>.Codec _map_type_codec = new pbc::MapField<int, global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType.Parser), 10); @@ -1468,14 +1388,6 @@ namespace Google.Protobuf.TestProtos { return new MessageContainingMapCalledEntry(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - entry_.Freeze(); - } - public const int EntryFieldNumber = 1; private static readonly pbc::MapField<int, int>.Codec _map_entry_codec = new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10); diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs index 517225b6..07ed125d 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs @@ -79,19 +79,11 @@ namespace Google.Protobuf.TestProtos { return new ImportMessage(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public const int DFieldNumber = 1; private int d_; public int D { get { return d_; } set { - pb::Freezable.CheckMutable(this); d_ = value; } } diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs index 11ec29dd..71403fbb 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs @@ -65,19 +65,11 @@ namespace Google.Protobuf.TestProtos { return new PublicImportMessage(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public const int EFieldNumber = 1; private int e_; public int E { get { return e_; } set { - pb::Freezable.CheckMutable(this); e_ = value; } } diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs index 07466650..f09d6769 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs @@ -96,13 +96,6 @@ namespace UnitTest.Issues.TestProtos { return new Issue307(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public override bool Equals(object other) { return Equals(other as Issue307); } @@ -187,13 +180,6 @@ namespace UnitTest.Issues.TestProtos { return new NestedOnce(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public override bool Equals(object other) { return Equals(other as NestedOnce); } @@ -278,13 +264,6 @@ namespace UnitTest.Issues.TestProtos { return new NestedTwice(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public override bool Equals(object other) { return Equals(other as NestedTwice); } @@ -381,21 +360,11 @@ namespace UnitTest.Issues.TestProtos { return new NegativeEnumMessage(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - values_.Freeze(); - packedValues_.Freeze(); - } - public const int ValueFieldNumber = 1; private global::UnitTest.Issues.TestProtos.NegativeEnum value_ = global::UnitTest.Issues.TestProtos.NegativeEnum.NEGATIVE_ENUM_ZERO; public global::UnitTest.Issues.TestProtos.NegativeEnum Value { get { return value_; } set { - pb::Freezable.CheckMutable(this); value_ = value; } } @@ -535,13 +504,6 @@ namespace UnitTest.Issues.TestProtos { return new DeprecatedChild(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public override bool Equals(object other) { return Equals(other as DeprecatedChild); } @@ -631,24 +593,12 @@ namespace UnitTest.Issues.TestProtos { return new DeprecatedFieldsMessage(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - primitiveArray_.Freeze(); - if (messageValue_ != null) MessageValue.Freeze(); - messageArray_.Freeze(); - enumArray_.Freeze(); - } - public const int PrimitiveValueFieldNumber = 1; private int primitiveValue_; [global::System.ObsoleteAttribute()] public int PrimitiveValue { get { return primitiveValue_; } set { - pb::Freezable.CheckMutable(this); primitiveValue_ = value; } } @@ -668,7 +618,6 @@ namespace UnitTest.Issues.TestProtos { public global::UnitTest.Issues.TestProtos.DeprecatedChild MessageValue { get { return messageValue_; } set { - pb::Freezable.CheckMutable(this); messageValue_ = value; } } @@ -688,7 +637,6 @@ namespace UnitTest.Issues.TestProtos { public global::UnitTest.Issues.TestProtos.DeprecatedEnum EnumValue { get { return enumValue_; } set { - pb::Freezable.CheckMutable(this); enumValue_ = value; } } @@ -869,19 +817,11 @@ namespace UnitTest.Issues.TestProtos { return new ItemField(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public const int ItemFieldNumber = 1; private int item_; public int Item { get { return item_; } set { - pb::Freezable.CheckMutable(this); item_ = value; } } diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs index 3d72c5a0..4d98cc25 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs @@ -307,46 +307,11 @@ namespace Google.Protobuf.TestProtos { return new TestAllTypes(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - if (singleNestedMessage_ != null) SingleNestedMessage.Freeze(); - if (singleForeignMessage_ != null) SingleForeignMessage.Freeze(); - if (singleImportMessage_ != null) SingleImportMessage.Freeze(); - if (singlePublicImportMessage_ != null) SinglePublicImportMessage.Freeze(); - repeatedInt32_.Freeze(); - repeatedInt64_.Freeze(); - repeatedUint32_.Freeze(); - repeatedUint64_.Freeze(); - repeatedSint32_.Freeze(); - repeatedSint64_.Freeze(); - repeatedFixed32_.Freeze(); - repeatedFixed64_.Freeze(); - repeatedSfixed32_.Freeze(); - repeatedSfixed64_.Freeze(); - repeatedFloat_.Freeze(); - repeatedDouble_.Freeze(); - repeatedBool_.Freeze(); - repeatedString_.Freeze(); - repeatedBytes_.Freeze(); - repeatedNestedMessage_.Freeze(); - repeatedForeignMessage_.Freeze(); - repeatedImportMessage_.Freeze(); - repeatedNestedEnum_.Freeze(); - repeatedForeignEnum_.Freeze(); - repeatedImportEnum_.Freeze(); - repeatedPublicImportMessage_.Freeze(); - if (oneofField_ is IFreezable) ((IFreezable) oneofField_).Freeze(); - } - public const int SingleInt32FieldNumber = 1; private int singleInt32_; public int SingleInt32 { get { return singleInt32_; } set { - pb::Freezable.CheckMutable(this); singleInt32_ = value; } } @@ -356,7 +321,6 @@ namespace Google.Protobuf.TestProtos { public long SingleInt64 { get { return singleInt64_; } set { - pb::Freezable.CheckMutable(this); singleInt64_ = value; } } @@ -366,7 +330,6 @@ namespace Google.Protobuf.TestProtos { public uint SingleUint32 { get { return singleUint32_; } set { - pb::Freezable.CheckMutable(this); singleUint32_ = value; } } @@ -376,7 +339,6 @@ namespace Google.Protobuf.TestProtos { public ulong SingleUint64 { get { return singleUint64_; } set { - pb::Freezable.CheckMutable(this); singleUint64_ = value; } } @@ -386,7 +348,6 @@ namespace Google.Protobuf.TestProtos { public int SingleSint32 { get { return singleSint32_; } set { - pb::Freezable.CheckMutable(this); singleSint32_ = value; } } @@ -396,7 +357,6 @@ namespace Google.Protobuf.TestProtos { public long SingleSint64 { get { return singleSint64_; } set { - pb::Freezable.CheckMutable(this); singleSint64_ = value; } } @@ -406,7 +366,6 @@ namespace Google.Protobuf.TestProtos { public uint SingleFixed32 { get { return singleFixed32_; } set { - pb::Freezable.CheckMutable(this); singleFixed32_ = value; } } @@ -416,7 +375,6 @@ namespace Google.Protobuf.TestProtos { public ulong SingleFixed64 { get { return singleFixed64_; } set { - pb::Freezable.CheckMutable(this); singleFixed64_ = value; } } @@ -426,7 +384,6 @@ namespace Google.Protobuf.TestProtos { public int SingleSfixed32 { get { return singleSfixed32_; } set { - pb::Freezable.CheckMutable(this); singleSfixed32_ = value; } } @@ -436,7 +393,6 @@ namespace Google.Protobuf.TestProtos { public long SingleSfixed64 { get { return singleSfixed64_; } set { - pb::Freezable.CheckMutable(this); singleSfixed64_ = value; } } @@ -446,7 +402,6 @@ namespace Google.Protobuf.TestProtos { public float SingleFloat { get { return singleFloat_; } set { - pb::Freezable.CheckMutable(this); singleFloat_ = value; } } @@ -456,7 +411,6 @@ namespace Google.Protobuf.TestProtos { public double SingleDouble { get { return singleDouble_; } set { - pb::Freezable.CheckMutable(this); singleDouble_ = value; } } @@ -466,7 +420,6 @@ namespace Google.Protobuf.TestProtos { public bool SingleBool { get { return singleBool_; } set { - pb::Freezable.CheckMutable(this); singleBool_ = value; } } @@ -476,7 +429,6 @@ namespace Google.Protobuf.TestProtos { public string SingleString { get { return singleString_; } set { - pb::Freezable.CheckMutable(this); singleString_ = value ?? ""; } } @@ -486,7 +438,6 @@ namespace Google.Protobuf.TestProtos { public pb::ByteString SingleBytes { get { return singleBytes_; } set { - pb::Freezable.CheckMutable(this); singleBytes_ = value ?? pb::ByteString.Empty; } } @@ -496,7 +447,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage SingleNestedMessage { get { return singleNestedMessage_; } set { - pb::Freezable.CheckMutable(this); singleNestedMessage_ = value; } } @@ -506,7 +456,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.TestProtos.ForeignMessage SingleForeignMessage { get { return singleForeignMessage_; } set { - pb::Freezable.CheckMutable(this); singleForeignMessage_ = value; } } @@ -516,7 +465,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.TestProtos.ImportMessage SingleImportMessage { get { return singleImportMessage_; } set { - pb::Freezable.CheckMutable(this); singleImportMessage_ = value; } } @@ -526,7 +474,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum SingleNestedEnum { get { return singleNestedEnum_; } set { - pb::Freezable.CheckMutable(this); singleNestedEnum_ = value; } } @@ -536,7 +483,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.TestProtos.ForeignEnum SingleForeignEnum { get { return singleForeignEnum_; } set { - pb::Freezable.CheckMutable(this); singleForeignEnum_ = value; } } @@ -546,7 +492,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.TestProtos.ImportEnum SingleImportEnum { get { return singleImportEnum_; } set { - pb::Freezable.CheckMutable(this); singleImportEnum_ = value; } } @@ -556,7 +501,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.TestProtos.PublicImportMessage SinglePublicImportMessage { get { return singlePublicImportMessage_; } set { - pb::Freezable.CheckMutable(this); singlePublicImportMessage_ = value; } } @@ -741,7 +685,6 @@ namespace Google.Protobuf.TestProtos { public uint OneofUint32 { get { return oneofFieldCase_ == OneofFieldOneofCase.OneofUint32 ? (uint) oneofField_ : 0; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = OneofFieldOneofCase.OneofUint32; } @@ -751,7 +694,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage OneofNestedMessage { get { return oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage ? (global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage) oneofField_ : null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.OneofNestedMessage; } @@ -761,7 +703,6 @@ namespace Google.Protobuf.TestProtos { public string OneofString { get { return oneofFieldCase_ == OneofFieldOneofCase.OneofString ? (string) oneofField_ : ""; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value ?? ""; oneofFieldCase_ = OneofFieldOneofCase.OneofString; } @@ -771,7 +712,6 @@ namespace Google.Protobuf.TestProtos { public pb::ByteString OneofBytes { get { return oneofFieldCase_ == OneofFieldOneofCase.OneofBytes ? (pb::ByteString) oneofField_ : pb::ByteString.Empty; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value ?? pb::ByteString.Empty; oneofFieldCase_ = OneofFieldOneofCase.OneofBytes; } @@ -791,7 +731,6 @@ namespace Google.Protobuf.TestProtos { } public void ClearOneofField() { - pb::Freezable.CheckMutable(this); oneofFieldCase_ = OneofFieldOneofCase.None; oneofField_ = null; } @@ -1551,19 +1490,11 @@ namespace Google.Protobuf.TestProtos { return new NestedMessage(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public const int BbFieldNumber = 1; private int bb_; public int Bb { get { return bb_; } set { - pb::Freezable.CheckMutable(this); bb_ = value; } } @@ -1675,22 +1606,11 @@ namespace Google.Protobuf.TestProtos { return new NestedTestAllTypes(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - if (child_ != null) Child.Freeze(); - if (payload_ != null) Payload.Freeze(); - repeatedChild_.Freeze(); - } - public const int ChildFieldNumber = 1; private global::Google.Protobuf.TestProtos.NestedTestAllTypes child_; public global::Google.Protobuf.TestProtos.NestedTestAllTypes Child { get { return child_; } set { - pb::Freezable.CheckMutable(this); child_ = value; } } @@ -1700,7 +1620,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.TestProtos.TestAllTypes Payload { get { return payload_; } set { - pb::Freezable.CheckMutable(this); payload_ = value; } } @@ -1850,20 +1769,12 @@ namespace Google.Protobuf.TestProtos { return new TestDeprecatedFields(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public const int DeprecatedInt32FieldNumber = 1; private int deprecatedInt32_; [global::System.ObsoleteAttribute()] public int DeprecatedInt32 { get { return deprecatedInt32_; } set { - pb::Freezable.CheckMutable(this); deprecatedInt32_ = value; } } @@ -1968,19 +1879,11 @@ namespace Google.Protobuf.TestProtos { return new ForeignMessage(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public const int CFieldNumber = 1; private int c_; public int C { get { return c_; } set { - pb::Freezable.CheckMutable(this); c_ = value; } } @@ -2084,13 +1987,6 @@ namespace Google.Protobuf.TestProtos { return new TestReservedFields(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public override bool Equals(object other) { return Equals(other as TestReservedFields); } @@ -2175,20 +2071,11 @@ namespace Google.Protobuf.TestProtos { return new TestForeignNested(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - if (foreignNested_ != null) ForeignNested.Freeze(); - } - public const int ForeignNestedFieldNumber = 1; private global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage foreignNested_; public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage ForeignNested { get { return foreignNested_; } set { - pb::Freezable.CheckMutable(this); foreignNested_ = value; } } @@ -2300,19 +2187,11 @@ namespace Google.Protobuf.TestProtos { return new TestReallyLargeTagNumber(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public const int AFieldNumber = 1; private int a_; public int A { get { return a_; } set { - pb::Freezable.CheckMutable(this); a_ = value; } } @@ -2322,7 +2201,6 @@ namespace Google.Protobuf.TestProtos { public int Bb { get { return bb_; } set { - pb::Freezable.CheckMutable(this); bb_ = value; } } @@ -2444,20 +2322,11 @@ namespace Google.Protobuf.TestProtos { return new TestRecursiveMessage(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - if (a_ != null) A.Freeze(); - } - public const int AFieldNumber = 1; private global::Google.Protobuf.TestProtos.TestRecursiveMessage a_; public global::Google.Protobuf.TestProtos.TestRecursiveMessage A { get { return a_; } set { - pb::Freezable.CheckMutable(this); a_ = value; } } @@ -2467,7 +2336,6 @@ namespace Google.Protobuf.TestProtos { public int I { get { return i_; } set { - pb::Freezable.CheckMutable(this); i_ = value; } } @@ -2594,20 +2462,11 @@ namespace Google.Protobuf.TestProtos { return new TestMutualRecursionA(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - if (bb_ != null) Bb.Freeze(); - } - public const int BbFieldNumber = 1; private global::Google.Protobuf.TestProtos.TestMutualRecursionB bb_; public global::Google.Protobuf.TestProtos.TestMutualRecursionB Bb { get { return bb_; } set { - pb::Freezable.CheckMutable(this); bb_ = value; } } @@ -2719,20 +2578,11 @@ namespace Google.Protobuf.TestProtos { return new TestMutualRecursionB(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - if (a_ != null) A.Freeze(); - } - public const int AFieldNumber = 1; private global::Google.Protobuf.TestProtos.TestMutualRecursionA a_; public global::Google.Protobuf.TestProtos.TestMutualRecursionA A { get { return a_; } set { - pb::Freezable.CheckMutable(this); a_ = value; } } @@ -2742,7 +2592,6 @@ namespace Google.Protobuf.TestProtos { public int OptionalInt32 { get { return optionalInt32_; } set { - pb::Freezable.CheckMutable(this); optionalInt32_ = value; } } @@ -2876,24 +2725,11 @@ namespace Google.Protobuf.TestProtos { return new TestCamelCaseFieldNames(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - if (messageField_ != null) MessageField.Freeze(); - repeatedPrimitiveField_.Freeze(); - repeatedStringField_.Freeze(); - repeatedEnumField_.Freeze(); - repeatedMessageField_.Freeze(); - } - public const int PrimitiveFieldFieldNumber = 1; private int primitiveField_; public int PrimitiveField { get { return primitiveField_; } set { - pb::Freezable.CheckMutable(this); primitiveField_ = value; } } @@ -2903,7 +2739,6 @@ namespace Google.Protobuf.TestProtos { public string StringField { get { return stringField_; } set { - pb::Freezable.CheckMutable(this); stringField_ = value ?? ""; } } @@ -2913,7 +2748,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.TestProtos.ForeignEnum EnumField { get { return enumField_; } set { - pb::Freezable.CheckMutable(this); enumField_ = value; } } @@ -2923,7 +2757,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.TestProtos.ForeignMessage MessageField { get { return messageField_; } set { - pb::Freezable.CheckMutable(this); messageField_ = value; } } @@ -3155,20 +2988,11 @@ namespace Google.Protobuf.TestProtos { return new TestFieldOrderings(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - if (singleNestedMessage_ != null) SingleNestedMessage.Freeze(); - } - public const int MyStringFieldNumber = 11; private string myString_ = ""; public string MyString { get { return myString_; } set { - pb::Freezable.CheckMutable(this); myString_ = value ?? ""; } } @@ -3178,7 +3002,6 @@ namespace Google.Protobuf.TestProtos { public long MyInt { get { return myInt_; } set { - pb::Freezable.CheckMutable(this); myInt_ = value; } } @@ -3188,7 +3011,6 @@ namespace Google.Protobuf.TestProtos { public float MyFloat { get { return myFloat_; } set { - pb::Freezable.CheckMutable(this); myFloat_ = value; } } @@ -3198,7 +3020,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage SingleNestedMessage { get { return singleNestedMessage_; } set { - pb::Freezable.CheckMutable(this); singleNestedMessage_ = value; } } @@ -3359,19 +3180,11 @@ namespace Google.Protobuf.TestProtos { return new NestedMessage(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public const int OoFieldNumber = 2; private long oo_; public long Oo { get { return oo_; } set { - pb::Freezable.CheckMutable(this); oo_ = value; } } @@ -3381,7 +3194,6 @@ namespace Google.Protobuf.TestProtos { public int Bb { get { return bb_; } set { - pb::Freezable.CheckMutable(this); bb_ = value; } } @@ -3507,19 +3319,11 @@ namespace Google.Protobuf.TestProtos { return new SparseEnumMessage(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public const int SparseEnumFieldNumber = 1; private global::Google.Protobuf.TestProtos.TestSparseEnum sparseEnum_ = global::Google.Protobuf.TestProtos.TestSparseEnum.TEST_SPARSE_ENUM_UNSPECIFIED; public global::Google.Protobuf.TestProtos.TestSparseEnum SparseEnum { get { return sparseEnum_; } set { - pb::Freezable.CheckMutable(this); sparseEnum_ = value; } } @@ -3624,19 +3428,11 @@ namespace Google.Protobuf.TestProtos { return new OneString(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public const int DataFieldNumber = 1; private string data_ = ""; public string Data { get { return data_; } set { - pb::Freezable.CheckMutable(this); data_ = value ?? ""; } } @@ -3741,14 +3537,6 @@ namespace Google.Protobuf.TestProtos { return new MoreString(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - data_.Freeze(); - } - public const int DataFieldNumber = 1; private static readonly pb::FieldCodec<string> _repeated_data_codec = pb::FieldCodec.ForString(10); @@ -3850,19 +3638,11 @@ namespace Google.Protobuf.TestProtos { return new OneBytes(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public const int DataFieldNumber = 1; private pb::ByteString data_ = pb::ByteString.Empty; public pb::ByteString Data { get { return data_; } set { - pb::Freezable.CheckMutable(this); data_ = value ?? pb::ByteString.Empty; } } @@ -3967,19 +3747,11 @@ namespace Google.Protobuf.TestProtos { return new MoreBytes(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public const int DataFieldNumber = 1; private pb::ByteString data_ = pb::ByteString.Empty; public pb::ByteString Data { get { return data_; } set { - pb::Freezable.CheckMutable(this); data_ = value ?? pb::ByteString.Empty; } } @@ -4084,19 +3856,11 @@ namespace Google.Protobuf.TestProtos { return new Int32Message(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public const int DataFieldNumber = 1; private int data_; public int Data { get { return data_; } set { - pb::Freezable.CheckMutable(this); data_ = value; } } @@ -4201,19 +3965,11 @@ namespace Google.Protobuf.TestProtos { return new Uint32Message(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public const int DataFieldNumber = 1; private uint data_; public uint Data { get { return data_; } set { - pb::Freezable.CheckMutable(this); data_ = value; } } @@ -4318,19 +4074,11 @@ namespace Google.Protobuf.TestProtos { return new Int64Message(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public const int DataFieldNumber = 1; private long data_; public long Data { get { return data_; } set { - pb::Freezable.CheckMutable(this); data_ = value; } } @@ -4435,19 +4183,11 @@ namespace Google.Protobuf.TestProtos { return new Uint64Message(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public const int DataFieldNumber = 1; private ulong data_; public ulong Data { get { return data_; } set { - pb::Freezable.CheckMutable(this); data_ = value; } } @@ -4552,19 +4292,11 @@ namespace Google.Protobuf.TestProtos { return new BoolMessage(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public const int DataFieldNumber = 1; private bool data_; public bool Data { get { return data_; } set { - pb::Freezable.CheckMutable(this); data_ = value; } } @@ -4680,19 +4412,10 @@ namespace Google.Protobuf.TestProtos { return new TestOneof(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - if (foo_ is IFreezable) ((IFreezable) foo_).Freeze(); - } - public const int FooIntFieldNumber = 1; public int FooInt { get { return fooCase_ == FooOneofCase.FooInt ? (int) foo_ : 0; } set { - pb::Freezable.CheckMutable(this); foo_ = value; fooCase_ = FooOneofCase.FooInt; } @@ -4702,7 +4425,6 @@ namespace Google.Protobuf.TestProtos { public string FooString { get { return fooCase_ == FooOneofCase.FooString ? (string) foo_ : ""; } set { - pb::Freezable.CheckMutable(this); foo_ = value ?? ""; fooCase_ = FooOneofCase.FooString; } @@ -4712,7 +4434,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.TestProtos.TestAllTypes FooMessage { get { return fooCase_ == FooOneofCase.FooMessage ? (global::Google.Protobuf.TestProtos.TestAllTypes) foo_ : null; } set { - pb::Freezable.CheckMutable(this); foo_ = value; fooCase_ = value == null ? FooOneofCase.None : FooOneofCase.FooMessage; } @@ -4731,7 +4452,6 @@ namespace Google.Protobuf.TestProtos { } public void ClearFoo() { - pb::Freezable.CheckMutable(this); fooCase_ = FooOneofCase.None; foo_ = null; } @@ -4889,27 +4609,6 @@ namespace Google.Protobuf.TestProtos { return new TestPackedTypes(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - packedInt32_.Freeze(); - packedInt64_.Freeze(); - packedUint32_.Freeze(); - packedUint64_.Freeze(); - packedSint32_.Freeze(); - packedSint64_.Freeze(); - packedFixed32_.Freeze(); - packedFixed64_.Freeze(); - packedSfixed32_.Freeze(); - packedSfixed64_.Freeze(); - packedFloat_.Freeze(); - packedDouble_.Freeze(); - packedBool_.Freeze(); - packedEnum_.Freeze(); - } - public const int PackedInt32FieldNumber = 90; private static readonly pb::FieldCodec<int> _repeated_packedInt32_codec = pb::FieldCodec.ForInt32(722); @@ -5259,27 +4958,6 @@ namespace Google.Protobuf.TestProtos { return new TestUnpackedTypes(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - unpackedInt32_.Freeze(); - unpackedInt64_.Freeze(); - unpackedUint32_.Freeze(); - unpackedUint64_.Freeze(); - unpackedSint32_.Freeze(); - unpackedSint64_.Freeze(); - unpackedFixed32_.Freeze(); - unpackedFixed64_.Freeze(); - unpackedSfixed32_.Freeze(); - unpackedSfixed64_.Freeze(); - unpackedFloat_.Freeze(); - unpackedDouble_.Freeze(); - unpackedBool_.Freeze(); - unpackedEnum_.Freeze(); - } - public const int UnpackedInt32FieldNumber = 90; private static readonly pb::FieldCodec<int> _repeated_unpackedInt32_codec = pb::FieldCodec.ForInt32(720); @@ -5621,19 +5299,6 @@ namespace Google.Protobuf.TestProtos { return new TestRepeatedScalarDifferentTagSizes(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - repeatedFixed32_.Freeze(); - repeatedInt32_.Freeze(); - repeatedFixed64_.Freeze(); - repeatedInt64_.Freeze(); - repeatedFloat_.Freeze(); - repeatedUint64_.Freeze(); - } - public const int RepeatedFixed32FieldNumber = 12; private static readonly pb::FieldCodec<uint> _repeated_repeatedFixed32_codec = pb::FieldCodec.ForFixed32(98); @@ -5826,19 +5491,11 @@ namespace Google.Protobuf.TestProtos { return new TestCommentInjectionMessage(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public const int AFieldNumber = 1; private string a_ = ""; public string A { get { return a_; } set { - pb::Freezable.CheckMutable(this); a_ = value ?? ""; } } @@ -5942,13 +5599,6 @@ namespace Google.Protobuf.TestProtos { return new FooRequest(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public override bool Equals(object other) { return Equals(other as FooRequest); } @@ -6032,13 +5682,6 @@ namespace Google.Protobuf.TestProtos { return new FooResponse(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public override bool Equals(object other) { return Equals(other as FooResponse); } @@ -6122,13 +5765,6 @@ namespace Google.Protobuf.TestProtos { return new FooClientMessage(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public override bool Equals(object other) { return Equals(other as FooClientMessage); } @@ -6212,13 +5848,6 @@ namespace Google.Protobuf.TestProtos { return new FooServerMessage(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public override bool Equals(object other) { return Equals(other as FooServerMessage); } @@ -6302,13 +5931,6 @@ namespace Google.Protobuf.TestProtos { return new BarRequest(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public override bool Equals(object other) { return Equals(other as BarRequest); } @@ -6392,13 +6014,6 @@ namespace Google.Protobuf.TestProtos { return new BarResponse(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - } - public override bool Equals(object other) { return Equals(other as BarResponse); } diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs index d9943dba..f938d70c 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs @@ -217,28 +217,11 @@ namespace Google.Protobuf.TestProtos { return new TestWellKnownTypes(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - if (anyField_ != null) AnyField.Freeze(); - if (apiField_ != null) ApiField.Freeze(); - if (durationField_ != null) DurationField.Freeze(); - if (emptyField_ != null) EmptyField.Freeze(); - if (fieldMaskField_ != null) FieldMaskField.Freeze(); - if (sourceContextField_ != null) SourceContextField.Freeze(); - if (structField_ != null) StructField.Freeze(); - if (timestampField_ != null) TimestampField.Freeze(); - if (typeField_ != null) TypeField.Freeze(); - } - public const int AnyFieldFieldNumber = 1; private global::Google.Protobuf.WellKnownTypes.Any anyField_; public global::Google.Protobuf.WellKnownTypes.Any AnyField { get { return anyField_; } set { - pb::Freezable.CheckMutable(this); anyField_ = value; } } @@ -248,7 +231,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.WellKnownTypes.Api ApiField { get { return apiField_; } set { - pb::Freezable.CheckMutable(this); apiField_ = value; } } @@ -258,7 +240,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.WellKnownTypes.Duration DurationField { get { return durationField_; } set { - pb::Freezable.CheckMutable(this); durationField_ = value; } } @@ -268,7 +249,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.WellKnownTypes.Empty EmptyField { get { return emptyField_; } set { - pb::Freezable.CheckMutable(this); emptyField_ = value; } } @@ -278,7 +258,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.WellKnownTypes.FieldMask FieldMaskField { get { return fieldMaskField_; } set { - pb::Freezable.CheckMutable(this); fieldMaskField_ = value; } } @@ -288,7 +267,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContextField { get { return sourceContextField_; } set { - pb::Freezable.CheckMutable(this); sourceContextField_ = value; } } @@ -298,7 +276,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.WellKnownTypes.Struct StructField { get { return structField_; } set { - pb::Freezable.CheckMutable(this); structField_ = value; } } @@ -308,7 +285,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.WellKnownTypes.Timestamp TimestampField { get { return timestampField_; } set { - pb::Freezable.CheckMutable(this); timestampField_ = value; } } @@ -318,7 +294,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.WellKnownTypes.Type TypeField { get { return typeField_; } set { - pb::Freezable.CheckMutable(this); typeField_ = value; } } @@ -329,7 +304,6 @@ namespace Google.Protobuf.TestProtos { public double? DoubleField { get { return doubleField_; } set { - pb::Freezable.CheckMutable(this); doubleField_ = value; } } @@ -340,7 +314,6 @@ namespace Google.Protobuf.TestProtos { public float? FloatField { get { return floatField_; } set { - pb::Freezable.CheckMutable(this); floatField_ = value; } } @@ -351,7 +324,6 @@ namespace Google.Protobuf.TestProtos { public long? Int64Field { get { return int64Field_; } set { - pb::Freezable.CheckMutable(this); int64Field_ = value; } } @@ -362,7 +334,6 @@ namespace Google.Protobuf.TestProtos { public ulong? Uint64Field { get { return uint64Field_; } set { - pb::Freezable.CheckMutable(this); uint64Field_ = value; } } @@ -373,7 +344,6 @@ namespace Google.Protobuf.TestProtos { public int? Int32Field { get { return int32Field_; } set { - pb::Freezable.CheckMutable(this); int32Field_ = value; } } @@ -384,7 +354,6 @@ namespace Google.Protobuf.TestProtos { public uint? Uint32Field { get { return uint32Field_; } set { - pb::Freezable.CheckMutable(this); uint32Field_ = value; } } @@ -395,7 +364,6 @@ namespace Google.Protobuf.TestProtos { public bool? BoolField { get { return boolField_; } set { - pb::Freezable.CheckMutable(this); boolField_ = value; } } @@ -406,7 +374,6 @@ namespace Google.Protobuf.TestProtos { public string StringField { get { return stringField_; } set { - pb::Freezable.CheckMutable(this); stringField_ = value; } } @@ -417,7 +384,6 @@ namespace Google.Protobuf.TestProtos { public pb::ByteString BytesField { get { return bytesField_; } set { - pb::Freezable.CheckMutable(this); bytesField_ = value; } } @@ -901,31 +867,6 @@ namespace Google.Protobuf.TestProtos { return new RepeatedWellKnownTypes(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - anyField_.Freeze(); - apiField_.Freeze(); - durationField_.Freeze(); - emptyField_.Freeze(); - fieldMaskField_.Freeze(); - sourceContextField_.Freeze(); - structField_.Freeze(); - timestampField_.Freeze(); - typeField_.Freeze(); - doubleField_.Freeze(); - floatField_.Freeze(); - int64Field_.Freeze(); - uint64Field_.Freeze(); - int32Field_.Freeze(); - uint32Field_.Freeze(); - boolField_.Freeze(); - stringField_.Freeze(); - bytesField_.Freeze(); - } - public const int AnyFieldFieldNumber = 1; private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Any> _repeated_anyField_codec = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.WellKnownTypes.Any.Parser); @@ -1372,19 +1313,10 @@ namespace Google.Protobuf.TestProtos { return new OneofWellKnownTypes(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - if (oneofField_ is IFreezable) ((IFreezable) oneofField_).Freeze(); - } - public const int AnyFieldFieldNumber = 1; public global::Google.Protobuf.WellKnownTypes.Any AnyField { get { return oneofFieldCase_ == OneofFieldOneofCase.AnyField ? (global::Google.Protobuf.WellKnownTypes.Any) oneofField_ : null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.AnyField; } @@ -1394,7 +1326,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.WellKnownTypes.Api ApiField { get { return oneofFieldCase_ == OneofFieldOneofCase.ApiField ? (global::Google.Protobuf.WellKnownTypes.Api) oneofField_ : null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.ApiField; } @@ -1404,7 +1335,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.WellKnownTypes.Duration DurationField { get { return oneofFieldCase_ == OneofFieldOneofCase.DurationField ? (global::Google.Protobuf.WellKnownTypes.Duration) oneofField_ : null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.DurationField; } @@ -1414,7 +1344,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.WellKnownTypes.Empty EmptyField { get { return oneofFieldCase_ == OneofFieldOneofCase.EmptyField ? (global::Google.Protobuf.WellKnownTypes.Empty) oneofField_ : null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.EmptyField; } @@ -1424,7 +1353,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.WellKnownTypes.FieldMask FieldMaskField { get { return oneofFieldCase_ == OneofFieldOneofCase.FieldMaskField ? (global::Google.Protobuf.WellKnownTypes.FieldMask) oneofField_ : null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.FieldMaskField; } @@ -1434,7 +1362,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContextField { get { return oneofFieldCase_ == OneofFieldOneofCase.SourceContextField ? (global::Google.Protobuf.WellKnownTypes.SourceContext) oneofField_ : null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.SourceContextField; } @@ -1444,7 +1371,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.WellKnownTypes.Struct StructField { get { return oneofFieldCase_ == OneofFieldOneofCase.StructField ? (global::Google.Protobuf.WellKnownTypes.Struct) oneofField_ : null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.StructField; } @@ -1454,7 +1380,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.WellKnownTypes.Timestamp TimestampField { get { return oneofFieldCase_ == OneofFieldOneofCase.TimestampField ? (global::Google.Protobuf.WellKnownTypes.Timestamp) oneofField_ : null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.TimestampField; } @@ -1464,7 +1389,6 @@ namespace Google.Protobuf.TestProtos { public global::Google.Protobuf.WellKnownTypes.Type TypeField { get { return oneofFieldCase_ == OneofFieldOneofCase.TypeField ? (global::Google.Protobuf.WellKnownTypes.Type) oneofField_ : null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.TypeField; } @@ -1475,7 +1399,6 @@ namespace Google.Protobuf.TestProtos { public double? DoubleField { get { return oneofFieldCase_ == OneofFieldOneofCase.DoubleField ? (double?) oneofField_ : (double?) null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.DoubleField; } @@ -1486,7 +1409,6 @@ namespace Google.Protobuf.TestProtos { public float? FloatField { get { return oneofFieldCase_ == OneofFieldOneofCase.FloatField ? (float?) oneofField_ : (float?) null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.FloatField; } @@ -1497,7 +1419,6 @@ namespace Google.Protobuf.TestProtos { public long? Int64Field { get { return oneofFieldCase_ == OneofFieldOneofCase.Int64Field ? (long?) oneofField_ : (long?) null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.Int64Field; } @@ -1508,7 +1429,6 @@ namespace Google.Protobuf.TestProtos { public ulong? Uint64Field { get { return oneofFieldCase_ == OneofFieldOneofCase.Uint64Field ? (ulong?) oneofField_ : (ulong?) null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.Uint64Field; } @@ -1519,7 +1439,6 @@ namespace Google.Protobuf.TestProtos { public int? Int32Field { get { return oneofFieldCase_ == OneofFieldOneofCase.Int32Field ? (int?) oneofField_ : (int?) null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.Int32Field; } @@ -1530,7 +1449,6 @@ namespace Google.Protobuf.TestProtos { public uint? Uint32Field { get { return oneofFieldCase_ == OneofFieldOneofCase.Uint32Field ? (uint?) oneofField_ : (uint?) null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.Uint32Field; } @@ -1541,7 +1459,6 @@ namespace Google.Protobuf.TestProtos { public bool? BoolField { get { return oneofFieldCase_ == OneofFieldOneofCase.BoolField ? (bool?) oneofField_ : (bool?) null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.BoolField; } @@ -1552,7 +1469,6 @@ namespace Google.Protobuf.TestProtos { public string StringField { get { return oneofFieldCase_ == OneofFieldOneofCase.StringField ? (string) oneofField_ : (string) null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.StringField; } @@ -1563,7 +1479,6 @@ namespace Google.Protobuf.TestProtos { public pb::ByteString BytesField { get { return oneofFieldCase_ == OneofFieldOneofCase.BytesField ? (pb::ByteString) oneofField_ : (pb::ByteString) null; } set { - pb::Freezable.CheckMutable(this); oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.BytesField; } @@ -1597,7 +1512,6 @@ namespace Google.Protobuf.TestProtos { } public void ClearOneofField() { - pb::Freezable.CheckMutable(this); oneofFieldCase_ = OneofFieldOneofCase.None; oneofField_ = null; } @@ -2030,31 +1944,6 @@ namespace Google.Protobuf.TestProtos { return new MapWellKnownTypes(this); } - public void Freeze() { - if (IsFrozen) { - return; - } - _frozen = true; - anyField_.Freeze(); - apiField_.Freeze(); - durationField_.Freeze(); - emptyField_.Freeze(); - fieldMaskField_.Freeze(); - sourceContextField_.Freeze(); - structField_.Freeze(); - timestampField_.Freeze(); - typeField_.Freeze(); - doubleField_.Freeze(); - floatField_.Freeze(); - int64Field_.Freeze(); - uint64Field_.Freeze(); - int32Field_.Freeze(); - uint32Field_.Freeze(); - boolField_.Freeze(); - stringField_.Freeze(); - bytesField_.Freeze(); - } - public const int AnyFieldFieldNumber = 1; private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Any>.Codec _map_anyField_codec = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Any>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Any.Parser), 10); |