Commit 8c896b25 authored by Jon Skeet's avatar Jon Skeet

Implement requested changes for IMessage<T>

1) New line at end of file
2) Make IMessage<T> itself extend IEquatable<T> and IDeepCloneable<T>
parent 6c1fe6ea
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#endregion #endregion
using System;
using Google.Protobuf.FieldAccess; using Google.Protobuf.FieldAccess;
namespace Google.Protobuf namespace Google.Protobuf
...@@ -84,7 +85,7 @@ namespace Google.Protobuf ...@@ -84,7 +85,7 @@ namespace Google.Protobuf
/// the implementation class. /// the implementation class.
/// </summary> /// </summary>
/// <typeparam name="T">The message type.</typeparam> /// <typeparam name="T">The message type.</typeparam>
public interface IMessage<T> : IMessage where T : IMessage<T> public interface IMessage<T> : IMessage, IEquatable<T>, IDeepCloneable<T> where T : IMessage<T>
{ {
/// <summary> /// <summary>
/// Merges the given message into this one. /// Merges the given message into this one.
...@@ -98,8 +99,8 @@ namespace Google.Protobuf ...@@ -98,8 +99,8 @@ namespace Google.Protobuf
/// Generic interface for a deeply cloneable type. /// Generic interface for a deeply cloneable type.
/// <summary> /// <summary>
/// <remarks> /// <remarks>
/// In practice, all generated messages implement this interface. /// All generated messages implement this interface, but so do some non-message types.
/// However, due to the type constraint on <c>T</c> in <see cref="IMessage{T}"/>, /// Additionally, due to the type constraint on <c>T</c> in <see cref="IMessage{T}"/>,
/// it is simpler to keep this as a separate interface. /// it is simpler to keep this as a separate interface.
/// </remarks> /// </remarks>
/// <typeparam name="T">The type itself, returned by the <see cref="Clone"/> method.</typeparam> /// <typeparam name="T">The type itself, returned by the <see cref="Clone"/> method.</typeparam>
......
...@@ -179,7 +179,7 @@ void MessageGenerator::Generate(io::Printer* printer) { ...@@ -179,7 +179,7 @@ void MessageGenerator::Generate(io::Printer* printer) {
WriteGeneratedCodeAttributes(printer); WriteGeneratedCodeAttributes(printer);
printer->Print( printer->Print(
vars, vars,
"$access_level$ sealed partial class $class_name$ : pb::IMessage<$class_name$>, global::System.IEquatable<$class_name$>, pb::IDeepCloneable<$class_name$> {\n"); "$access_level$ sealed partial class $class_name$ : pb::IMessage<$class_name$> {\n");
printer->Indent(); printer->Indent();
// All static fields and properties // All static fields and properties
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment