@@ -6,23 +6,48 @@ namespace System.Diagnostics.CodeAnalysis
6
6
{
7
7
/// <summary>Specifies that null is allowed as an input even if the corresponding type disallows it.</summary>
8
8
[ AttributeUsage ( AttributeTargets . Field | AttributeTargets . Parameter | AttributeTargets . Property , Inherited = false ) ]
9
- public sealed class AllowNullAttribute : Attribute { }
9
+ #if INTERNAL_NULLABLE_ATTRIBUTES
10
+ internal
11
+ #else
12
+ public
13
+ #endif
14
+ sealed class AllowNullAttribute : Attribute { }
10
15
11
16
/// <summary>Specifies that null is disallowed as an input even if the corresponding type allows it.</summary>
12
17
[ AttributeUsage ( AttributeTargets . Field | AttributeTargets . Parameter | AttributeTargets . Property , Inherited = false ) ]
13
- public sealed class DisallowNullAttribute : Attribute { }
18
+ #if INTERNAL_NULLABLE_ATTRIBUTES
19
+ internal
20
+ #else
21
+ public
22
+ #endif
23
+ sealed class DisallowNullAttribute : Attribute { }
14
24
15
25
/// <summary>Specifies that an output may be null even if the corresponding type disallows it.</summary>
16
26
[ AttributeUsage ( AttributeTargets . Field | AttributeTargets . Parameter | AttributeTargets . Property | AttributeTargets . ReturnValue , Inherited = false ) ]
17
- public sealed class MaybeNullAttribute : Attribute { }
27
+ #if INTERNAL_NULLABLE_ATTRIBUTES
28
+ internal
29
+ #else
30
+ public
31
+ #endif
32
+ sealed class MaybeNullAttribute : Attribute { }
18
33
19
34
/// <summary>Specifies that an output will not be null even if the corresponding type allows it.</summary>
20
35
[ AttributeUsage ( AttributeTargets . Field | AttributeTargets . Parameter | AttributeTargets . Property | AttributeTargets . ReturnValue , Inherited = false ) ]
21
- public sealed class NotNullAttribute : Attribute { }
36
+ #if INTERNAL_NULLABLE_ATTRIBUTES
37
+ internal
38
+ #else
39
+ public
40
+ #endif
41
+ sealed class NotNullAttribute : Attribute { }
22
42
23
43
/// <summary>Specifies that when a method returns <see cref="ReturnValue"/>, the parameter may be null even if the corresponding type disallows it.</summary>
24
44
[ AttributeUsage ( AttributeTargets . Parameter , Inherited = false ) ]
25
- public sealed class MaybeNullWhenAttribute : Attribute
45
+ #if INTERNAL_NULLABLE_ATTRIBUTES
46
+ internal
47
+ #else
48
+ public
49
+ #endif
50
+ sealed class MaybeNullWhenAttribute : Attribute
26
51
{
27
52
/// <summary>Initializes the attribute with the specified return value condition.</summary>
28
53
/// <param name="returnValue">
@@ -36,7 +61,12 @@ public sealed class MaybeNullWhenAttribute : Attribute
36
61
37
62
/// <summary>Specifies that when a method returns <see cref="ReturnValue"/>, the parameter will not be null even if the corresponding type allows it.</summary>
38
63
[ AttributeUsage ( AttributeTargets . Parameter , Inherited = false ) ]
39
- public sealed class NotNullWhenAttribute : Attribute
64
+ #if INTERNAL_NULLABLE_ATTRIBUTES
65
+ internal
66
+ #else
67
+ public
68
+ #endif
69
+ sealed class NotNullWhenAttribute : Attribute
40
70
{
41
71
/// <summary>Initializes the attribute with the specified return value condition.</summary>
42
72
/// <param name="returnValue">
@@ -50,7 +80,12 @@ public sealed class NotNullWhenAttribute : Attribute
50
80
51
81
/// <summary>Specifies that the output will be non-null if the named parameter is non-null.</summary>
52
82
[ AttributeUsage ( AttributeTargets . Parameter | AttributeTargets . Property | AttributeTargets . ReturnValue , AllowMultiple = true , Inherited = false ) ]
53
- public sealed class NotNullIfNotNullAttribute : Attribute
83
+ #if INTERNAL_NULLABLE_ATTRIBUTES
84
+ internal
85
+ #else
86
+ public
87
+ #endif
88
+ sealed class NotNullIfNotNullAttribute : Attribute
54
89
{
55
90
/// <summary>Initializes the attribute with the associated parameter name.</summary>
56
91
/// <param name="parameterName">
@@ -64,11 +99,21 @@ public sealed class NotNullIfNotNullAttribute : Attribute
64
99
65
100
/// <summary>Applied to a method that will never return under any circumstance.</summary>
66
101
[ AttributeUsage ( AttributeTargets . Method , Inherited = false ) ]
67
- public sealed class DoesNotReturnAttribute : Attribute { }
102
+ #if INTERNAL_NULLABLE_ATTRIBUTES
103
+ internal
104
+ #else
105
+ public
106
+ #endif
107
+ sealed class DoesNotReturnAttribute : Attribute { }
68
108
69
109
/// <summary>Specifies that the method will not return if the associated Boolean parameter is passed the specified value.</summary>
70
110
[ AttributeUsage ( AttributeTargets . Parameter , Inherited = false ) ]
71
- public sealed class DoesNotReturnIfAttribute : Attribute
111
+ #if INTERNAL_NULLABLE_ATTRIBUTES
112
+ internal
113
+ #else
114
+ public
115
+ #endif
116
+ sealed class DoesNotReturnIfAttribute : Attribute
72
117
{
73
118
/// <summary>Initializes the attribute with the specified parameter value.</summary>
74
119
/// <param name="parameterValue">
0 commit comments