This is an automated email from the ASF dual-hosted git repository. blachniet pushed a commit to branch branch-1.9 in repository https://gitbox.apache.org/repos/asf/avro.git
commit 408bd2c34ea93b8d497792c7a2852fb7033454c0 Author: Brian Lachniet <[email protected]> AuthorDate: Sun Aug 18 21:00:26 2019 -0400 AVRO-2454: Fix CA1715 - Identifiers should have correct prefix (cherry picked from commit 2014d7d6f86ad0a48f801ef152dbc88ef208f620) --- lang/csharp/Avro.ruleset | 1 - lang/csharp/src/apache/main/Generic/DatumReader.cs | 2 ++ lang/csharp/src/apache/main/Generic/DatumWriter.cs | 2 ++ lang/csharp/src/apache/main/Generic/GenericReader.cs | 4 ++-- lang/csharp/src/apache/main/Generic/GenericWriter.cs | 8 ++++---- lang/csharp/src/apache/main/Generic/PreresolvingDatumWriter.cs | 8 ++++---- lang/csharp/src/apache/main/IO/Decoder.cs | 2 ++ lang/csharp/src/apache/main/IO/Encoder.cs | 2 ++ 8 files changed, 18 insertions(+), 11 deletions(-) diff --git a/lang/csharp/Avro.ruleset b/lang/csharp/Avro.ruleset index 00e630d..4900e32 100644 --- a/lang/csharp/Avro.ruleset +++ b/lang/csharp/Avro.ruleset @@ -27,7 +27,6 @@ <Rule Id="CA1062" Action="Info" /> <Rule Id="CA1707" Action="Info" /> <Rule Id="CA1710" Action="Info" /> - <Rule Id="CA1715" Action="Info" /> <Rule Id="CA1716" Action="Info" /> <Rule Id="CA1720" Action="Info" /> <Rule Id="CA1721" Action="Info" /> diff --git a/lang/csharp/src/apache/main/Generic/DatumReader.cs b/lang/csharp/src/apache/main/Generic/DatumReader.cs index e1f4213..a8a2bbc 100644 --- a/lang/csharp/src/apache/main/Generic/DatumReader.cs +++ b/lang/csharp/src/apache/main/Generic/DatumReader.cs @@ -23,6 +23,8 @@ namespace Avro.Generic /// Defines the interface for an object that reads data of a schema. /// </summary> /// <typeparam name="T">Type of the in-memory data representation.</typeparam> + [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", + "CA1715:Identifiers should have correct prefix", Justification = "Maintain public API")] public interface DatumReader<T> { /// <summary> diff --git a/lang/csharp/src/apache/main/Generic/DatumWriter.cs b/lang/csharp/src/apache/main/Generic/DatumWriter.cs index dcf7993..be68365 100644 --- a/lang/csharp/src/apache/main/Generic/DatumWriter.cs +++ b/lang/csharp/src/apache/main/Generic/DatumWriter.cs @@ -23,6 +23,8 @@ namespace Avro.Generic /// Defines the interface for an object that writes data of a schema. /// </summary> /// <typeparam name="T">Type of the in-memory data representation.</typeparam> + [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", + "CA1715:Identifiers should have correct prefix", Justification = "Maintain public API")] public interface DatumWriter<T> { /// <summary> diff --git a/lang/csharp/src/apache/main/Generic/GenericReader.cs b/lang/csharp/src/apache/main/Generic/GenericReader.cs index 9c1a25e..b6813fa 100644 --- a/lang/csharp/src/apache/main/Generic/GenericReader.cs +++ b/lang/csharp/src/apache/main/Generic/GenericReader.cs @@ -246,12 +246,12 @@ namespace Avro.Generic /// <summary> /// A generic function to read primitive types /// </summary> - /// <typeparam name="S">The .NET type to read</typeparam> + /// <typeparam name="T">The .NET type to read</typeparam> /// <param name="tag">The Avro type tag for the object on the stream</param> /// <param name="readerSchema">A schema compatible to the Avro type</param> /// <param name="reader">A function that can read the avro type from the stream</param> /// <returns>The primitive type just read</returns> - protected S Read<S>(Schema.Type tag, Schema readerSchema, Reader<S> reader) + protected T Read<T>(Schema.Type tag, Schema readerSchema, Reader<T> reader) { return reader(); } diff --git a/lang/csharp/src/apache/main/Generic/GenericWriter.cs b/lang/csharp/src/apache/main/Generic/GenericWriter.cs index f2fb24a..5f439bb 100644 --- a/lang/csharp/src/apache/main/Generic/GenericWriter.cs +++ b/lang/csharp/src/apache/main/Generic/GenericWriter.cs @@ -179,14 +179,14 @@ namespace Avro.Generic /// <summary> /// A generic method to serialize primitive Avro types. /// </summary> - /// <typeparam name="S">Type of the C# type to be serialized</typeparam> + /// <typeparam name="T">Type of the C# type to be serialized</typeparam> /// <param name="value">The value to be serialized</param> /// <param name="tag">The schema type tag</param> /// <param name="writer">The writer which should be used to write the given type.</param> - protected virtual void Write<S>(object value, Schema.Type tag, Writer<S> writer) + protected virtual void Write<T>(object value, Schema.Type tag, Writer<T> writer) { - if (!(value is S)) throw TypeMismatch(value, tag.ToString(), typeof(S).ToString()); - writer((S)value); + if (!(value is T)) throw TypeMismatch(value, tag.ToString(), typeof(T).ToString()); + writer((T)value); } /// <summary> diff --git a/lang/csharp/src/apache/main/Generic/PreresolvingDatumWriter.cs b/lang/csharp/src/apache/main/Generic/PreresolvingDatumWriter.cs index 7b52721..e4e96d3 100644 --- a/lang/csharp/src/apache/main/Generic/PreresolvingDatumWriter.cs +++ b/lang/csharp/src/apache/main/Generic/PreresolvingDatumWriter.cs @@ -117,14 +117,14 @@ namespace Avro.Generic /// <summary> /// A generic method to serialize primitive Avro types. /// </summary> - /// <typeparam name="S">Type of the C# type to be serialized</typeparam> + /// <typeparam name="TValue">Type of the C# type to be serialized</typeparam> /// <param name="value">The value to be serialized</param> /// <param name="tag">The schema type tag</param> /// <param name="writer">The writer which should be used to write the given type.</param> - protected void Write<S>(object value, Schema.Type tag, Writer<S> writer) + protected void Write<TValue>(object value, Schema.Type tag, Writer<TValue> writer) { - if (!(value is S)) throw TypeMismatch(value, tag.ToString(), typeof(S).ToString()); - writer((S)value); + if (!(value is TValue)) throw TypeMismatch(value, tag.ToString(), typeof(TValue).ToString()); + writer((TValue)value); } diff --git a/lang/csharp/src/apache/main/IO/Decoder.cs b/lang/csharp/src/apache/main/IO/Decoder.cs index 573a8dd..536c1e9 100644 --- a/lang/csharp/src/apache/main/IO/Decoder.cs +++ b/lang/csharp/src/apache/main/IO/Decoder.cs @@ -22,6 +22,8 @@ namespace Avro.IO /// Decoder is used to decode Avro data on a stream. There are methods to read the Avro types on the stream. There are also /// methods to skip items, which are usually more efficient than reading, on the stream. /// </summary> + [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", + "CA1715:Identifiers should have correct prefix", Justification = "Maintain public API")] public interface Decoder { /// <summary> diff --git a/lang/csharp/src/apache/main/IO/Encoder.cs b/lang/csharp/src/apache/main/IO/Encoder.cs index e04f3eb..24d7381 100644 --- a/lang/csharp/src/apache/main/IO/Encoder.cs +++ b/lang/csharp/src/apache/main/IO/Encoder.cs @@ -22,6 +22,8 @@ namespace Avro.IO /// Defines the interface for a class that provies low-level support for serializing Avro /// values. /// </summary> + [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", + "CA1715:Identifiers should have correct prefix", Justification = "Maintain public API")] public interface Encoder { /// <summary>
