Skip to content

Commit

Permalink
Fixed NullableAttributes
Browse files Browse the repository at this point in the history
  • Loading branch information
jstedfast committed Aug 30, 2024
1 parent cc4c3b9 commit dab013b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
2 changes: 0 additions & 2 deletions MimeKit/MimeKit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@
<Compile Remove="Cryptography\LdapUri.cs" />
<Compile Remove="Utils\OptimizedOrdinalComparer.cs" />
<Compile Include="Utils\OptimizedOrdinalComparer.cs" Condition=" $(TargetFramework.StartsWith('net4')) Or '$(TargetFramework)' == 'netstandard2.0' " />
<Compile Remove="NullableAttributes.cs" />
<Compile Include="NullableAttributes.cs" Condition=" $(TargetFramework.StartsWith('net4')) Or '$(TargetFramework)' == 'netstandard2.0' " />
</ItemGroup>

</Project>
2 changes: 0 additions & 2 deletions MimeKit/MimeKitLite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@
<Compile Include="Cryptography\AuthenticationResults.cs" />
<Compile Remove="Utils\OptimizedOrdinalComparer.cs" />
<Compile Include="Utils\OptimizedOrdinalComparer.cs" Condition=" $(TargetFramework.StartsWith('net4')) Or '$(TargetFramework)' == 'netstandard2.0' " />
<Compile Remove="NullableAttributes.cs" />
<Compile Include="NullableAttributes.cs" Condition=" $(TargetFramework.StartsWith('net4')) Or '$(TargetFramework)' == 'netstandard2.0' " />
</ItemGroup>

</Project>
50 changes: 27 additions & 23 deletions MimeKit/NullableAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
//

namespace System.Diagnostics.CodeAnalysis {
#if NETFRAMEWORK || NETSTANDARD2_0
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property, Inherited = false)]
sealed class AllowNullAttribute : Attribute
{
Expand Down Expand Up @@ -65,8 +66,32 @@ sealed class MaybeNullWhenAttribute : Attribute
public bool ReturnValue { get; }
}

[AttributeUsage (AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, Inherited = false)]
sealed class NotNullAttribute : Attribute
{
public NotNullAttribute () { }
}

[AttributeUsage (AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
sealed class NotNullIfNotNullAttribute : Attribute
{
public NotNullIfNotNullAttribute (string parameterName) => ParameterName = parameterName;

public string ParameterName { get; }
}

[AttributeUsage (AttributeTargets.Parameter, Inherited = false)]
sealed class NotNullWhenAttribute : Attribute
{
public NotNullWhenAttribute (bool returnValue) => ReturnValue = returnValue;

public bool ReturnValue { get; }
}
#endif

#if NETFRAMEWORK || NETSTANDARD2_0 || NETSTANDARD2_1
[AttributeUsage (AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
sealed class MemberNotNullAttribute : Attribute
public sealed class MemberNotNullAttribute : Attribute

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'

Check warning on line 94 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute'
{
public MemberNotNullAttribute (string member) => Members = new string[] { member };

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Release)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Check warning on line 96 in MimeKit/NullableAttributes.cs

View workflow job for this annotation

GitHub Actions / ci (windows-latest, Debug)

Missing XML comment for publicly visible type or member 'MemberNotNullAttribute.MemberNotNullAttribute(string)'

Expand Down Expand Up @@ -94,26 +119,5 @@ public MemberNotNullWhenAttribute (bool returnValue, string[] members)

public bool ReturnValue { get; }
}

[AttributeUsage (AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, Inherited = false)]
sealed class NotNullAttribute : Attribute
{
public NotNullAttribute () { }
}

[AttributeUsage (AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
sealed class NotNullIfNotNullAttribute : Attribute
{
public NotNullIfNotNullAttribute (string parameterName) => ParameterName = parameterName;

public string ParameterName { get; }
}

[AttributeUsage (AttributeTargets.Parameter, Inherited = false)]
sealed class NotNullWhenAttribute : Attribute
{
public NotNullWhenAttribute (bool returnValue) => ReturnValue = returnValue;

public bool ReturnValue { get; }
}
#endif
}

0 comments on commit dab013b

Please sign in to comment.