You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2022/05/03 18:54:31 UTC
[avro] branch branch-1.11 updated: AVRO-3499 Remove unnecessary suppressions (#1656)
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/branch-1.11 by this push:
new 10eaa51f1 AVRO-3499 Remove unnecessary suppressions (#1656)
10eaa51f1 is described below
commit 10eaa51f1c70d191f94c2ccebe265f1a811dc00d
Author: Kyle Schoonover <ky...@minmaxcorp.com>
AuthorDate: Tue May 3 11:54:08 2022 -0700
AVRO-3499 Remove unnecessary suppressions (#1656)
(cherry picked from commit 923ea8e6042db6eddbd727ee303adc54ae58f4b9)
---
lang/csharp/src/apache/main/Generic/DatumWriter.cs | 3 +--
lang/csharp/src/apache/main/IO/Decoder.cs | 2 --
lang/csharp/src/apache/main/IO/Encoder.cs | 2 --
lang/csharp/src/apache/main/Protocol/Message.cs | 8 +++----
lang/csharp/src/apache/main/Protocol/Protocol.cs | 9 ++++----
lang/csharp/src/apache/main/Schema/EnumSchema.cs | 8 ++++---
lang/csharp/src/apache/main/Schema/Field.cs | 14 ++---------
lang/csharp/src/apache/main/Schema/SchemaName.cs | 27 ++++++++++------------
8 files changed, 27 insertions(+), 46 deletions(-)
diff --git a/lang/csharp/src/apache/main/Generic/DatumWriter.cs b/lang/csharp/src/apache/main/Generic/DatumWriter.cs
index be6836537..0b732d9d7 100644
--- a/lang/csharp/src/apache/main/Generic/DatumWriter.cs
+++ b/lang/csharp/src/apache/main/Generic/DatumWriter.cs
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
using Avro.IO;
namespace Avro.Generic
@@ -23,8 +24,6 @@ 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/IO/Decoder.cs b/lang/csharp/src/apache/main/IO/Decoder.cs
index 6270a4177..1476b0e1a 100644
--- a/lang/csharp/src/apache/main/IO/Decoder.cs
+++ b/lang/csharp/src/apache/main/IO/Decoder.cs
@@ -22,8 +22,6 @@ 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 ee26a7512..84a2099a1 100644
--- a/lang/csharp/src/apache/main/IO/Encoder.cs
+++ b/lang/csharp/src/apache/main/IO/Encoder.cs
@@ -22,8 +22,6 @@ namespace Avro.IO
/// Defines the interface for a class that provides 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>
diff --git a/lang/csharp/src/apache/main/Protocol/Message.cs b/lang/csharp/src/apache/main/Protocol/Message.cs
index 732438c93..19cc61c84 100644
--- a/lang/csharp/src/apache/main/Protocol/Message.cs
+++ b/lang/csharp/src/apache/main/Protocol/Message.cs
@@ -198,12 +198,10 @@ namespace Avro
/// <returns></returns>
public override int GetHashCode()
{
-#pragma warning disable CA1307 // Specify StringComparison
return Name.GetHashCode() +
-#pragma warning restore CA1307 // Specify StringComparison
- Request.GetHashCode() +
- (Response == null ? 0 : Response.GetHashCode()) +
- (Error == null ? 0 : Error.GetHashCode());
+ Request.GetHashCode() +
+ (Response == null ? 0 : Response.GetHashCode()) +
+ (Error == null ? 0 : Error.GetHashCode());
}
/// <summary>
diff --git a/lang/csharp/src/apache/main/Protocol/Protocol.cs b/lang/csharp/src/apache/main/Protocol/Protocol.cs
index 1f5b54106..94ae1268a 100644
--- a/lang/csharp/src/apache/main/Protocol/Protocol.cs
+++ b/lang/csharp/src/apache/main/Protocol/Protocol.cs
@@ -269,10 +269,8 @@ namespace Avro
/// <returns></returns>
public override int GetHashCode()
{
-#pragma warning disable CA1307 // Specify StringComparison
return Name.GetHashCode() + Namespace.GetHashCode() +
-#pragma warning restore CA1307 // Specify StringComparison
- GetTypesHashCode() + GetMessagesHashCode();
+ GetTypesHashCode() + GetMessagesHashCode();
}
/// <summary>
@@ -295,9 +293,10 @@ namespace Avro
{
int hash = Messages.Count;
foreach (KeyValuePair<string, Message> pair in Messages)
-#pragma warning disable CA1307 // Specify StringComparison
+ {
hash += pair.Key.GetHashCode() + pair.Value.GetHashCode();
-#pragma warning restore CA1307 // Specify StringComparison
+ }
+
return hash;
}
}
diff --git a/lang/csharp/src/apache/main/Schema/EnumSchema.cs b/lang/csharp/src/apache/main/Schema/EnumSchema.cs
index 295b73ebd..225780310 100644
--- a/lang/csharp/src/apache/main/Schema/EnumSchema.cs
+++ b/lang/csharp/src/apache/main/Schema/EnumSchema.cs
@@ -289,9 +289,11 @@ namespace Avro
public override int GetHashCode()
{
int result = SchemaName.GetHashCode() + getHashCode(Props);
-#pragma warning disable CA1307 // Specify StringComparison
- foreach (string s in Symbols) result += 23 * s.GetHashCode();
-#pragma warning restore CA1307 // Specify StringComparison
+ foreach (string s in Symbols)
+ {
+ result += 23 * s.GetHashCode();
+ }
+
return result;
}
diff --git a/lang/csharp/src/apache/main/Schema/Field.cs b/lang/csharp/src/apache/main/Schema/Field.cs
index 0c3f7afca..799f265b3 100644
--- a/lang/csharp/src/apache/main/Schema/Field.cs
+++ b/lang/csharp/src/apache/main/Schema/Field.cs
@@ -54,18 +54,10 @@ namespace Avro
/// </summary>
public readonly string Name;
- /// <summary>
- /// List of aliases for the field name
- /// </summary>
- [Obsolete("Use Aliases instead. This will be removed from the public API in a future version.")]
- public readonly IList<string> aliases;
-
-#pragma warning disable CS0618 // Type or member is obsolete
/// <summary>
/// List of aliases for the field name.
/// </summary>
- public IList<string> Aliases => aliases;
-#pragma warning restore CS0618 // Type or member is obsolete
+ public IList<string> Aliases { get; private set; }
/// <summary>
/// Position of the field within its record.
@@ -163,9 +155,7 @@ namespace Avro
Schema = schema ?? throw new ArgumentNullException("type", "type cannot be null.");
Name = name;
-#pragma warning disable CS0618 // Type or member is obsolete
- this.aliases = aliases;
-#pragma warning restore CS0618 // Type or member is obsolete
+ Aliases = aliases;
Pos = pos;
Documentation = doc;
DefaultValue = defaultValue;
diff --git a/lang/csharp/src/apache/main/Schema/SchemaName.cs b/lang/csharp/src/apache/main/Schema/SchemaName.cs
index 11d22daa5..7716d7a55 100644
--- a/lang/csharp/src/apache/main/Schema/SchemaName.cs
+++ b/lang/csharp/src/apache/main/Schema/SchemaName.cs
@@ -65,30 +65,29 @@ namespace Avro
/// <param name="space">namespace of the schema</param>
/// <param name="encspace">enclosing namespace of the schema</param>
/// <param name="documentation">documentation of the schema</param>
- public SchemaName(String name, String space, String encspace, String documentation)
+ public SchemaName(string name, string space, string encspace, string documentation)
{
if (name == null)
{ // anonymous
- this.Name = this.Space = null;
- this.EncSpace = encspace; // need to save enclosing namespace for anonymous types, so named types within the anonymous type can be resolved
+ Name = Space = null;
+ EncSpace = encspace; // need to save enclosing namespace for anonymous types, so named types within the anonymous type can be resolved
}
-#pragma warning disable CA1307 // Specify StringComparison
else if (!name.Contains("."))
-#pragma warning restore CA1307 // Specify StringComparison
{ // unqualified name
- this.Space = space; // use default space
- this.Name = name;
- this.EncSpace = encspace;
+ Space = space; // use default space
+ Name = name;
+ EncSpace = encspace;
}
else
{
string[] parts = name.Split('.');
- this.Space = string.Join(".", parts, 0, parts.Length - 1);
- this.Name = parts[parts.Length - 1];
- this.EncSpace = encspace;
+ Space = string.Join(".", parts, 0, parts.Length - 1);
+ Name = parts[parts.Length - 1];
+ EncSpace = encspace;
}
- this.Documentation = documentation;
- fullName = string.IsNullOrEmpty(Namespace) ? this.Name : Namespace + "." + this.Name;
+
+ Documentation = documentation;
+ fullName = string.IsNullOrEmpty(Namespace) ? Name : Namespace + "." + Name;
}
/// <summary>
@@ -149,9 +148,7 @@ namespace Avro
/// <inheritdoc/>
public override int GetHashCode()
{
-#pragma warning disable CA1307 // Specify StringComparison
return string.IsNullOrEmpty(Fullname) ? 0 : 29 * Fullname.GetHashCode();
-#pragma warning restore CA1307 // Specify StringComparison
}
}