Skip to content

Commit 789a047

Browse files
committed
Remove unnecessary conditional compilation
1 parent 96efe1d commit 789a047

1 file changed

Lines changed: 11 additions & 68 deletions

File tree

src/Tools/LeanCode.CodeAnalysis/NetStandard21Compatibility/System.Diagnostics.CodeAnalysis.NullableAttributes.cs

Lines changed: 11 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -6,57 +6,31 @@
66

77
namespace System.Diagnostics.CodeAnalysis;
88

9-
#if !NETSTANDARD2_1
109
/// <summary>Specifies that null is allowed as an input even if the corresponding type disallows it.</summary>
1110
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property, Inherited = false)]
12-
#if SYSTEM_PRIVATE_CORELIB
13-
public
14-
#else
15-
internal
16-
#endif
17-
sealed class AllowNullAttribute : Attribute { }
11+
internal sealed class AllowNullAttribute : Attribute { }
1812

1913
/// <summary>Specifies that null is disallowed as an input even if the corresponding type allows it.</summary>
2014
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property, Inherited = false)]
21-
#if SYSTEM_PRIVATE_CORELIB
22-
public
23-
#else
24-
internal
25-
#endif
26-
sealed class DisallowNullAttribute : Attribute { }
15+
internal sealed class DisallowNullAttribute : Attribute { }
2716

2817
/// <summary>Specifies that an output may be null even if the corresponding type disallows it.</summary>
2918
[AttributeUsage(
3019
AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue,
3120
Inherited = false
3221
)]
33-
#if SYSTEM_PRIVATE_CORELIB
34-
public
35-
#else
36-
internal
37-
#endif
38-
sealed class MaybeNullAttribute : Attribute { }
22+
internal sealed class MaybeNullAttribute : Attribute { }
3923

4024
/// <summary>Specifies that an output will not be null even if the corresponding type allows it. Specifies that an input argument was not null when the call returns.</summary>
4125
[AttributeUsage(
4226
AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue,
4327
Inherited = false
4428
)]
45-
#if SYSTEM_PRIVATE_CORELIB
46-
public
47-
#else
48-
internal
49-
#endif
50-
sealed class NotNullAttribute : Attribute { }
29+
internal sealed class NotNullAttribute : Attribute { }
5130

5231
/// <summary>Specifies that when a method returns <see cref="ReturnValue"/>, the parameter may be null even if the corresponding type disallows it.</summary>
5332
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
54-
#if SYSTEM_PRIVATE_CORELIB
55-
public
56-
#else
57-
internal
58-
#endif
59-
sealed class MaybeNullWhenAttribute : Attribute
33+
internal sealed class MaybeNullWhenAttribute : Attribute
6034
{
6135
/// <summary>Initializes the attribute with the specified return value condition.</summary>
6236
/// <param name="returnValue">
@@ -70,12 +44,7 @@ sealed class MaybeNullWhenAttribute : Attribute
7044

7145
/// <summary>Specifies that when a method returns <see cref="ReturnValue"/>, the parameter will not be null even if the corresponding type allows it.</summary>
7246
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
73-
#if SYSTEM_PRIVATE_CORELIB
74-
public
75-
#else
76-
internal
77-
#endif
78-
sealed class NotNullWhenAttribute : Attribute
47+
internal sealed class NotNullWhenAttribute : Attribute
7948
{
8049
/// <summary>Initializes the attribute with the specified return value condition.</summary>
8150
/// <param name="returnValue">
@@ -93,12 +62,7 @@ sealed class NotNullWhenAttribute : Attribute
9362
AllowMultiple = true,
9463
Inherited = false
9564
)]
96-
#if SYSTEM_PRIVATE_CORELIB
97-
public
98-
#else
99-
internal
100-
#endif
101-
sealed class NotNullIfNotNullAttribute : Attribute
65+
internal sealed class NotNullIfNotNullAttribute : Attribute
10266
{
10367
/// <summary>Initializes the attribute with the associated parameter name.</summary>
10468
/// <param name="parameterName">
@@ -112,21 +76,11 @@ sealed class NotNullIfNotNullAttribute : Attribute
11276

11377
/// <summary>Applied to a method that will never return under any circumstance.</summary>
11478
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
115-
#if SYSTEM_PRIVATE_CORELIB
116-
public
117-
#else
118-
internal
119-
#endif
120-
sealed class DoesNotReturnAttribute : Attribute { }
79+
internal sealed class DoesNotReturnAttribute : Attribute { }
12180

12281
/// <summary>Specifies that the method will not return if the associated Boolean parameter is passed the specified value.</summary>
12382
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
124-
#if SYSTEM_PRIVATE_CORELIB
125-
public
126-
#else
127-
internal
128-
#endif
129-
sealed class DoesNotReturnIfAttribute : Attribute
83+
internal sealed class DoesNotReturnIfAttribute : Attribute
13084
{
13185
/// <summary>Initializes the attribute with the specified parameter value.</summary>
13286
/// <param name="parameterValue">
@@ -138,16 +92,10 @@ sealed class DoesNotReturnIfAttribute : Attribute
13892
/// <summary>Gets the condition parameter value.</summary>
13993
public bool ParameterValue { get; }
14094
}
141-
#endif
14295

14396
/// <summary>Specifies that the method or property will ensure that the listed field and property members have not-null values.</summary>
14497
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
145-
#if SYSTEM_PRIVATE_CORELIB
146-
public
147-
#else
148-
internal
149-
#endif
150-
sealed class MemberNotNullAttribute : Attribute
98+
internal sealed class MemberNotNullAttribute : Attribute
15199
{
152100
/// <summary>Initializes the attribute with a field or property member.</summary>
153101
/// <param name="member">
@@ -167,12 +115,7 @@ sealed class MemberNotNullAttribute : Attribute
167115

168116
/// <summary>Specifies that the method or property will ensure that the listed field and property members have not-null values when returning with the specified return value condition.</summary>
169117
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
170-
#if SYSTEM_PRIVATE_CORELIB
171-
public
172-
#else
173-
internal
174-
#endif
175-
sealed class MemberNotNullWhenAttribute : Attribute
118+
internal sealed class MemberNotNullWhenAttribute : Attribute
176119
{
177120
/// <summary>Initializes the attribute with the specified return value condition and a field or property member.</summary>
178121
/// <param name="returnValue">

0 commit comments

Comments
 (0)