Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.Data.* missed Equals nullable annotations #52165

Merged
merged 8 commits into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;

namespace System.Data.Common
{
// DbConnectionPoolKey: Base class implementation of a key to connection pool groups
Expand Down Expand Up @@ -37,7 +39,7 @@ internal string? ConnectionString
}
}

public override bool Equals(object? obj)
public override bool Equals([NotNullWhen(true)] object? obj)
{
if (obj == null || obj.GetType() != typeof(DbConnectionPoolKey))
{
Expand Down
30 changes: 15 additions & 15 deletions src/libraries/System.Data.Common/ref/System.Data.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ public ForeignKeyConstraint(string? constraintName, string? parentTableName, str
public override System.Data.DataTable? Table { get { throw null; } }
[System.ComponentModel.DefaultValueAttribute(System.Data.Rule.Cascade)]
public virtual System.Data.Rule UpdateRule { get { throw null; } set { } }
public override bool Equals(object? key) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? key) { throw null; }
public override int GetHashCode() { throw null; }
}
public partial interface IColumnMapping
Expand Down Expand Up @@ -1609,7 +1609,7 @@ public UniqueConstraint(string? name, string[]? columnNames, bool isPrimaryKey)
public bool IsPrimaryKey { get { throw null; } }
[System.ComponentModel.ReadOnlyAttribute(true)]
public override System.Data.DataTable? Table { get { throw null; } }
public override bool Equals(object? key2) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? key2) { throw null; }
public override int GetHashCode() { throw null; }
}
public enum UpdateRowSource
Expand Down Expand Up @@ -2588,7 +2588,7 @@ public partial struct SqlBinary : System.Data.SqlTypes.INullable, System.ICompar
public int CompareTo(object? value) { throw null; }
public static System.Data.SqlTypes.SqlBinary Concat(System.Data.SqlTypes.SqlBinary x, System.Data.SqlTypes.SqlBinary y) { throw null; }
public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlBinary x, System.Data.SqlTypes.SqlBinary y) { throw null; }
public override bool Equals(object? value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; }
public static System.Data.SqlTypes.SqlBoolean GreaterThan(System.Data.SqlTypes.SqlBinary x, System.Data.SqlTypes.SqlBinary y) { throw null; }
Expand Down Expand Up @@ -2632,7 +2632,7 @@ public partial struct SqlBoolean : System.Data.SqlTypes.INullable, System.ICompa
public int CompareTo(System.Data.SqlTypes.SqlBoolean value) { throw null; }
public int CompareTo(object? value) { throw null; }
public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlBoolean x, System.Data.SqlTypes.SqlBoolean y) { throw null; }
public override bool Equals(object? value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; }
public static System.Data.SqlTypes.SqlBoolean GreaterThan(System.Data.SqlTypes.SqlBoolean x, System.Data.SqlTypes.SqlBoolean y) { throw null; }
Expand Down Expand Up @@ -2700,7 +2700,7 @@ public partial struct SqlByte : System.Data.SqlTypes.INullable, System.IComparab
public int CompareTo(object? value) { throw null; }
public static System.Data.SqlTypes.SqlByte Divide(System.Data.SqlTypes.SqlByte x, System.Data.SqlTypes.SqlByte y) { throw null; }
public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlByte x, System.Data.SqlTypes.SqlByte y) { throw null; }
public override bool Equals(object? value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; }
public static System.Data.SqlTypes.SqlBoolean GreaterThan(System.Data.SqlTypes.SqlByte x, System.Data.SqlTypes.SqlByte y) { throw null; }
Expand Down Expand Up @@ -2846,7 +2846,7 @@ public partial struct SqlDateTime : System.Data.SqlTypes.INullable, System.IComp
public int CompareTo(System.Data.SqlTypes.SqlDateTime value) { throw null; }
public int CompareTo(object? value) { throw null; }
public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlDateTime x, System.Data.SqlTypes.SqlDateTime y) { throw null; }
public override bool Equals(object? value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; }
public static System.Data.SqlTypes.SqlBoolean GreaterThan(System.Data.SqlTypes.SqlDateTime x, System.Data.SqlTypes.SqlDateTime y) { throw null; }
Expand Down Expand Up @@ -2904,7 +2904,7 @@ public partial struct SqlDecimal : System.Data.SqlTypes.INullable, System.ICompa
public static System.Data.SqlTypes.SqlDecimal ConvertToPrecScale(System.Data.SqlTypes.SqlDecimal n, int precision, int scale) { throw null; }
public static System.Data.SqlTypes.SqlDecimal Divide(System.Data.SqlTypes.SqlDecimal x, System.Data.SqlTypes.SqlDecimal y) { throw null; }
public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlDecimal x, System.Data.SqlTypes.SqlDecimal y) { throw null; }
public override bool Equals(object? value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public static System.Data.SqlTypes.SqlDecimal Floor(System.Data.SqlTypes.SqlDecimal n) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; }
Expand Down Expand Up @@ -2975,7 +2975,7 @@ public partial struct SqlDouble : System.Data.SqlTypes.INullable, System.ICompar
public int CompareTo(object? value) { throw null; }
public static System.Data.SqlTypes.SqlDouble Divide(System.Data.SqlTypes.SqlDouble x, System.Data.SqlTypes.SqlDouble y) { throw null; }
public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlDouble x, System.Data.SqlTypes.SqlDouble y) { throw null; }
public override bool Equals(object? value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; }
public static System.Data.SqlTypes.SqlBoolean GreaterThan(System.Data.SqlTypes.SqlDouble x, System.Data.SqlTypes.SqlDouble y) { throw null; }
Expand Down Expand Up @@ -3037,7 +3037,7 @@ public partial struct SqlGuid : System.Data.SqlTypes.INullable, System.IComparab
public int CompareTo(System.Data.SqlTypes.SqlGuid value) { throw null; }
public int CompareTo(object? value) { throw null; }
public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlGuid x, System.Data.SqlTypes.SqlGuid y) { throw null; }
public override bool Equals(object? value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; }
public static System.Data.SqlTypes.SqlBoolean GreaterThan(System.Data.SqlTypes.SqlGuid x, System.Data.SqlTypes.SqlGuid y) { throw null; }
Expand Down Expand Up @@ -3082,7 +3082,7 @@ public partial struct SqlInt16 : System.Data.SqlTypes.INullable, System.ICompara
public int CompareTo(object? value) { throw null; }
public static System.Data.SqlTypes.SqlInt16 Divide(System.Data.SqlTypes.SqlInt16 x, System.Data.SqlTypes.SqlInt16 y) { throw null; }
public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlInt16 x, System.Data.SqlTypes.SqlInt16 y) { throw null; }
public override bool Equals(object? value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; }
public static System.Data.SqlTypes.SqlBoolean GreaterThan(System.Data.SqlTypes.SqlInt16 x, System.Data.SqlTypes.SqlInt16 y) { throw null; }
Expand Down Expand Up @@ -3156,7 +3156,7 @@ public partial struct SqlInt32 : System.Data.SqlTypes.INullable, System.ICompara
public int CompareTo(object? value) { throw null; }
public static System.Data.SqlTypes.SqlInt32 Divide(System.Data.SqlTypes.SqlInt32 x, System.Data.SqlTypes.SqlInt32 y) { throw null; }
public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlInt32 x, System.Data.SqlTypes.SqlInt32 y) { throw null; }
public override bool Equals(object? value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; }
public static System.Data.SqlTypes.SqlBoolean GreaterThan(System.Data.SqlTypes.SqlInt32 x, System.Data.SqlTypes.SqlInt32 y) { throw null; }
Expand Down Expand Up @@ -3230,7 +3230,7 @@ public partial struct SqlInt64 : System.Data.SqlTypes.INullable, System.ICompara
public int CompareTo(object? value) { throw null; }
public static System.Data.SqlTypes.SqlInt64 Divide(System.Data.SqlTypes.SqlInt64 x, System.Data.SqlTypes.SqlInt64 y) { throw null; }
public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlInt64 x, System.Data.SqlTypes.SqlInt64 y) { throw null; }
public override bool Equals(object? value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; }
public static System.Data.SqlTypes.SqlBoolean GreaterThan(System.Data.SqlTypes.SqlInt64 x, System.Data.SqlTypes.SqlInt64 y) { throw null; }
Expand Down Expand Up @@ -3305,7 +3305,7 @@ public partial struct SqlMoney : System.Data.SqlTypes.INullable, System.ICompara
public int CompareTo(object? value) { throw null; }
public static System.Data.SqlTypes.SqlMoney Divide(System.Data.SqlTypes.SqlMoney x, System.Data.SqlTypes.SqlMoney y) { throw null; }
public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlMoney x, System.Data.SqlTypes.SqlMoney y) { throw null; }
public override bool Equals(object? value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; }
public static System.Data.SqlTypes.SqlBoolean GreaterThan(System.Data.SqlTypes.SqlMoney x, System.Data.SqlTypes.SqlMoney y) { throw null; }
Expand Down Expand Up @@ -3387,7 +3387,7 @@ public partial struct SqlSingle : System.Data.SqlTypes.INullable, System.ICompar
public int CompareTo(object? value) { throw null; }
public static System.Data.SqlTypes.SqlSingle Divide(System.Data.SqlTypes.SqlSingle x, System.Data.SqlTypes.SqlSingle y) { throw null; }
public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlSingle x, System.Data.SqlTypes.SqlSingle y) { throw null; }
public override bool Equals(object? value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; }
public static System.Data.SqlTypes.SqlBoolean GreaterThan(System.Data.SqlTypes.SqlSingle x, System.Data.SqlTypes.SqlSingle y) { throw null; }
Expand Down Expand Up @@ -3466,7 +3466,7 @@ public partial struct SqlString : System.Data.SqlTypes.INullable, System.ICompar
public int CompareTo(object? value) { throw null; }
public static System.Data.SqlTypes.SqlString Concat(System.Data.SqlTypes.SqlString x, System.Data.SqlTypes.SqlString y) { throw null; }
public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlString x, System.Data.SqlTypes.SqlString y) { throw null; }
public override bool Equals(object? value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public byte[]? GetNonUnicodeBytes() { throw null; }
public byte[]? GetUnicodeBytes() { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.ComponentModel;
using System.Diagnostics;
using System.Data.Common;
using System.Diagnostics.CodeAnalysis;

namespace System.Data
{
Expand Down Expand Up @@ -855,7 +856,7 @@ public virtual Rule DeleteRule
/// <summary>
/// Gets a value indicating whether the current <see cref='System.Data.ForeignKeyConstraint'/> is identical to the specified object.
/// </summary>
public override bool Equals(object? key)
public override bool Equals([NotNullWhen(true)] object? key)
{
if (!(key is ForeignKeyConstraint))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace System.Data
{
Expand Down Expand Up @@ -89,7 +90,7 @@ internal override void SetIndex(string newSort, DataViewRowState newRowStates, I
Reset();
}

public override bool Equals(DataView? dv)
public override bool Equals([NotNullWhen(true)] DataView? dv)
{
RelatedView? other = dv as RelatedView;
if (other == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Diagnostics.CodeAnalysis;

namespace System.Data.SqlTypes
{
Expand Down Expand Up @@ -362,7 +363,7 @@ public int CompareTo(SqlBinary value)
}

// Compares this instance with a specified object
public override bool Equals(object? value)
public override bool Equals([NotNullWhen(true)] object? value)
{
if (!(value is SqlBinary))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Diagnostics.CodeAnalysis;

namespace System.Data.SqlTypes
{
Expand Down Expand Up @@ -464,7 +465,7 @@ public int CompareTo(SqlBoolean value)
}

// Compares this instance with a specified object
public override bool Equals(object? value)
public override bool Equals([NotNullWhen(true)] object? value)
{
if (!(value is SqlBoolean))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Diagnostics.CodeAnalysis;

namespace System.Data.SqlTypes
{
Expand Down Expand Up @@ -473,7 +474,7 @@ public int CompareTo(SqlByte value)
}

// Compares this instance with a specified object
public override bool Equals(object? value)
public override bool Equals([NotNullWhen(true)] object? value)
{
if (!(value is SqlByte))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Diagnostics.CodeAnalysis;

namespace System.Data.SqlTypes
{
Expand Down Expand Up @@ -620,7 +621,7 @@ public int CompareTo(SqlDateTime value)
}

// Compares this instance with a specified object
public override bool Equals(object? value)
public override bool Equals([NotNullWhen(true)] object? value)
{
if (!(value is SqlDateTime))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Diagnostics.CodeAnalysis;

namespace System.Data.SqlTypes
{
Expand Down Expand Up @@ -3279,7 +3280,7 @@ public int CompareTo(SqlDecimal value)
}

// Compares this instance with a specified object
public override bool Equals(object? value)
public override bool Equals([NotNullWhen(true)] object? value)
{
if (!(value is SqlDecimal))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Diagnostics.CodeAnalysis;

namespace System.Data.SqlTypes
{
Expand Down Expand Up @@ -389,7 +390,7 @@ public int CompareTo(SqlDouble value)
}

// Compares this instance with a specified object
public override bool Equals(object? value)
public override bool Equals([NotNullWhen(true)] object? value)
{
if (!(value is SqlDouble))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Diagnostics.CodeAnalysis;

namespace System.Data.SqlTypes
{
Expand Down Expand Up @@ -280,7 +281,7 @@ public int CompareTo(SqlGuid value)
}

// Compares this instance with a specified object
public override bool Equals(object? value)
public override bool Equals([NotNullWhen(true)] object? value)
{
if (!(value is SqlGuid))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Diagnostics.CodeAnalysis;

namespace System.Data.SqlTypes
{
Expand Down Expand Up @@ -474,7 +475,7 @@ public int CompareTo(SqlInt16 value)
}

// Compares this instance with a specified object
public override bool Equals(object? value)
public override bool Equals([NotNullWhen(true)] object? value)
{
if (!(value is SqlInt16))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Diagnostics.CodeAnalysis;

namespace System.Data.SqlTypes
{
Expand Down Expand Up @@ -489,7 +490,7 @@ public int CompareTo(SqlInt32 value)
}

// Compares this instance with a specified object
public override bool Equals(object? value)
public override bool Equals([NotNullWhen(true)] object? value)
{
if (!(value is SqlInt32))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Diagnostics.CodeAnalysis;

namespace System.Data.SqlTypes
{
Expand Down Expand Up @@ -548,7 +549,7 @@ public int CompareTo(SqlInt64 value)
}

// Compares this instance with a specified object
public override bool Equals(object? value)
public override bool Equals([NotNullWhen(true)] object? value)
{
if (!(value is SqlInt64))
{
Expand Down
Loading