From 92389f22fabb6331e693a434846addbf07fb8dce Mon Sep 17 00:00:00 2001 From: buyaa-n Date: Fri, 12 Apr 2019 17:00:35 -0700 Subject: [PATCH] Nullable: Enums, Structures from Reflection folder (#23933) * Nullable: Enums, Structures from Reflection --- .../shared/System/Reflection/AssemblyContentType.cs | 1 + .../shared/System/Reflection/AssemblyNameFlags.cs | 1 + .../shared/System/Reflection/BindingFlags.cs | 1 + .../shared/System/Reflection/CallingConventions.cs | 1 + .../shared/System/Reflection/CorElementType.cs | 1 + .../shared/System/Reflection/Emit/AssemblyBuilderAccess.cs | 3 +-- .../shared/System/Reflection/Emit/EventToken.cs | 3 ++- .../shared/System/Reflection/Emit/FieldToken.cs | 3 ++- .../shared/System/Reflection/Emit/FlowControl.cs | 3 +-- .../shared/System/Reflection/Emit/Label.cs | 7 ++----- .../shared/System/Reflection/Emit/MethodToken.cs | 3 ++- .../shared/System/Reflection/Emit/OpCodeType.cs | 3 +-- .../shared/System/Reflection/Emit/OpCodes.cs | 1 + .../shared/System/Reflection/Emit/Opcode.cs | 13 +++++++------ .../shared/System/Reflection/Emit/OperandType.cs | 3 +-- .../shared/System/Reflection/Emit/PEFileKinds.cs | 4 +--- .../shared/System/Reflection/Emit/PackingSize.cs | 1 + .../shared/System/Reflection/Emit/ParameterToken.cs | 3 ++- .../shared/System/Reflection/Emit/PropertyToken.cs | 3 ++- .../shared/System/Reflection/Emit/SignatureToken.cs | 3 ++- .../shared/System/Reflection/Emit/StackBehaviour.cs | 3 +-- .../shared/System/Reflection/Emit/StringToken.cs | 3 ++- .../shared/System/Reflection/Emit/TypeToken.cs | 3 ++- .../shared/System/Reflection/EventAttributes.cs | 1 + .../shared/System/Reflection/ExceptionHandlingClause.cs | 3 ++- .../System/Reflection/ExceptionHandlingClauseOptions.cs | 1 + .../shared/System/Reflection/FieldAttributes.cs | 1 + .../shared/System/Reflection/GenericParameterAttributes.cs | 1 + .../shared/System/Reflection/ImageFileMachine.cs | 1 + .../shared/System/Reflection/InterfaceMapping.cs | 1 + .../shared/System/Reflection/MemberTypes.cs | 3 ++- .../shared/System/Reflection/MethodAttributes.cs | 1 + .../shared/System/Reflection/MethodImplAttributes.cs | 1 + .../shared/System/Reflection/ParameterAttributes.cs | 1 + .../shared/System/Reflection/ParameterModifier.cs | 1 + .../shared/System/Reflection/PortableExecutableKinds.cs | 1 + .../shared/System/Reflection/ProcessorArchitecture.cs | 1 + .../shared/System/Reflection/PropertyAttributes.cs | 1 + .../shared/System/Reflection/ResourceAttributes.cs | 1 + .../shared/System/Reflection/ResourceLocation.cs | 1 + .../shared/System/Reflection/TypeAttributes.cs | 3 +-- .../src/System/Reflection/INVOCATION_FLAGS.cs | 1 + .../src/System/Reflection/RuntimeExceptionHandlingClause.cs | 7 ++++--- 43 files changed, 63 insertions(+), 39 deletions(-) diff --git a/src/System.Private.CoreLib/shared/System/Reflection/AssemblyContentType.cs b/src/System.Private.CoreLib/shared/System/Reflection/AssemblyContentType.cs index 2ee1a00..938ac26 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/AssemblyContentType.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/AssemblyContentType.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection { public enum AssemblyContentType diff --git a/src/System.Private.CoreLib/shared/System/Reflection/AssemblyNameFlags.cs b/src/System.Private.CoreLib/shared/System/Reflection/AssemblyNameFlags.cs index d321032..82f64c1 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/AssemblyNameFlags.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/AssemblyNameFlags.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection { [Flags] diff --git a/src/System.Private.CoreLib/shared/System/Reflection/BindingFlags.cs b/src/System.Private.CoreLib/shared/System/Reflection/BindingFlags.cs index 7ba83e2..ac64814 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/BindingFlags.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/BindingFlags.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection { [Flags] diff --git a/src/System.Private.CoreLib/shared/System/Reflection/CallingConventions.cs b/src/System.Private.CoreLib/shared/System/Reflection/CallingConventions.cs index bb6d6cd..3bd0607 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/CallingConventions.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/CallingConventions.cs @@ -4,6 +4,7 @@ // CallingConventions is a set of Bits representing the calling conventions in the system. +#nullable enable namespace System.Reflection { [Flags] diff --git a/src/System.Private.CoreLib/shared/System/Reflection/CorElementType.cs b/src/System.Private.CoreLib/shared/System/Reflection/CorElementType.cs index 37ffcfa..b6968f1 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/CorElementType.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/CorElementType.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection { internal enum CorElementType : byte diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/AssemblyBuilderAccess.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/AssemblyBuilderAccess.cs index b096960..baac3a7 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/AssemblyBuilderAccess.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/AssemblyBuilderAccess.cs @@ -2,11 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; - // This enumeration defines the access modes for a dynamic assembly. // EE uses these enum values..look for m_dwDynamicAssemblyAccess in Assembly.hpp +#nullable enable namespace System.Reflection.Emit { [Flags] diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/EventToken.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/EventToken.cs index 7bcc9ac..85c9178 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/EventToken.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/EventToken.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection.Emit { public struct EventToken @@ -17,7 +18,7 @@ namespace System.Reflection.Emit public override int GetHashCode() => Token; - public override bool Equals(object obj) => obj is EventToken et && Equals(et); + public override bool Equals(object? obj) => obj is EventToken et && Equals(et); public bool Equals(EventToken obj) => obj.Token == Token; diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/FieldToken.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/FieldToken.cs index 83af736..e0aba63 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/FieldToken.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/FieldToken.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection.Emit { /// @@ -26,7 +27,7 @@ namespace System.Reflection.Emit public override int GetHashCode() => Token; - public override bool Equals(object obj) => obj is FieldToken ft && Equals(ft); + public override bool Equals(object? obj) => obj is FieldToken ft && Equals(ft); public bool Equals(FieldToken obj) => obj.Token == Token && obj._class == _class; diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/FlowControl.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/FlowControl.cs index 12a97c7..0410cc9 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/FlowControl.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/FlowControl.cs @@ -12,8 +12,7 @@ ** See $(RepoRoot)\src\inc\OpCodeGen.pl for more information.** ==============================================================*/ -using System; - +#nullable enable namespace System.Reflection.Emit { public enum FlowControl diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/Label.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/Label.cs index 503d8b3..4aa5e7c 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/Label.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/Label.cs @@ -14,10 +14,7 @@ ** ===========================================================*/ -using System; -using System.Reflection; -using System.Runtime.InteropServices; - +#nullable enable namespace System.Reflection.Emit { // The Label class is an opaque representation of a label used by the @@ -49,7 +46,7 @@ namespace System.Reflection.Emit return m_label; } - public override bool Equals(object obj) + public override bool Equals(object? obj) { if (obj is Label) return Equals((Label)obj); diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/MethodToken.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/MethodToken.cs index be4b0ee..0ed6872 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/MethodToken.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/MethodToken.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection.Emit { public struct MethodToken @@ -17,7 +18,7 @@ namespace System.Reflection.Emit public override int GetHashCode() => Token; - public override bool Equals(object obj) => obj is MethodToken mt && Equals(mt); + public override bool Equals(object? obj) => obj is MethodToken mt && Equals(mt); public bool Equals(MethodToken obj) => obj.Token == Token; diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/OpCodeType.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/OpCodeType.cs index 4304c73..779aaca 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/OpCodeType.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/OpCodeType.cs @@ -12,8 +12,7 @@ ** See $(RepoRoot)\src\inc\OpCodeGen.pl for more information.** ==============================================================*/ -using System; - +#nullable enable namespace System.Reflection.Emit { public enum OpCodeType diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/OpCodes.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/OpCodes.cs index 7690005..b489593 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/OpCodes.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/OpCodes.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection.Emit { // diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/Opcode.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/Opcode.cs index fdac84f..6b191bf 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/Opcode.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/Opcode.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Threading; namespace System.Reflection.Emit @@ -108,9 +109,9 @@ namespace System.Reflection.Emit } } - private static volatile string[] g_nameCache; + private static volatile string[]? g_nameCache; - public string Name + public string? Name { get { @@ -119,7 +120,7 @@ namespace System.Reflection.Emit // Create and cache the opcode names lazily. They should be rarely used (only for logging, etc.) // Note that we do not any locks here because of we always get the same names. The last one wins. - string[] nameCache = g_nameCache; + string[]? nameCache = g_nameCache; if (nameCache == null) { nameCache = new string[0x11f]; @@ -149,13 +150,13 @@ namespace System.Reflection.Emit return name; // Create ilasm style name from the enum value name. - name = Enum.GetName(typeof(OpCodeValues), opCodeValue).ToLowerInvariant().Replace('_', '.'); + name = Enum.GetName(typeof(OpCodeValues), opCodeValue)!.ToLowerInvariant().Replace('_', '.'); Volatile.Write(ref nameCache[idx], name); return name; } } - public override bool Equals(object obj) + public override bool Equals(object? obj) { if (obj is OpCode) return Equals((OpCode)obj); @@ -183,7 +184,7 @@ namespace System.Reflection.Emit return Value; } - public override string ToString() + public override string? ToString() { return Name; } diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/OperandType.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/OperandType.cs index 356fffa..3bc5c70 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/OperandType.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/OperandType.cs @@ -12,8 +12,7 @@ ** See $(RepoRoot)\src\inc\OpCodeGen.pl for more information.** ==============================================================*/ -using System; - +#nullable enable namespace System.Reflection.Emit { public enum OperandType diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/PEFileKinds.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/PEFileKinds.cs index f6606c4..d01e6bf 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/PEFileKinds.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/PEFileKinds.cs @@ -2,9 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. - -using System; - +#nullable enable namespace System.Reflection.Emit { // This Enum matchs the CorFieldAttr defined in CorHdr.h diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/PackingSize.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/PackingSize.cs index f734e1a..d0bb044 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/PackingSize.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/PackingSize.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection.Emit { public enum PackingSize diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/ParameterToken.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/ParameterToken.cs index d8a087d..a0ce2ee 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/ParameterToken.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/ParameterToken.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection.Emit { /// @@ -21,7 +22,7 @@ namespace System.Reflection.Emit public override int GetHashCode() => Token; - public override bool Equals(object obj) => obj is ParameterToken pt && Equals(pt); + public override bool Equals(object? obj) => obj is ParameterToken pt && Equals(pt); public bool Equals(ParameterToken obj) => obj.Token == Token; diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/PropertyToken.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/PropertyToken.cs index b63fe78..c116426 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/PropertyToken.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/PropertyToken.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection.Emit { public struct PropertyToken @@ -17,7 +18,7 @@ namespace System.Reflection.Emit public override int GetHashCode() => Token; - public override bool Equals(object obj) => obj is PropertyToken pt && Equals(pt); + public override bool Equals(object? obj) => obj is PropertyToken pt && Equals(pt); public bool Equals(PropertyToken obj) => obj.Token == Token; diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/SignatureToken.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/SignatureToken.cs index ba58358..5af7ca2 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/SignatureToken.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/SignatureToken.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection.Emit { public struct SignatureToken @@ -17,7 +18,7 @@ namespace System.Reflection.Emit public override int GetHashCode() => Token; - public override bool Equals(object obj) => obj is SignatureToken st && Equals(st); + public override bool Equals(object? obj) => obj is SignatureToken st && Equals(st); public bool Equals(SignatureToken obj) => obj.Token == Token; diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/StackBehaviour.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/StackBehaviour.cs index 3e64b48..6015da5 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/StackBehaviour.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/StackBehaviour.cs @@ -12,8 +12,7 @@ ** See $(RepoRoot)\src\inc\OpCodeGen.pl for more information.** ==============================================================*/ -using System; - +#nullable enable namespace System.Reflection.Emit { public enum StackBehaviour diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/StringToken.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/StringToken.cs index 380f0ab..02d3a87 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/StringToken.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/StringToken.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection.Emit { public struct StringToken @@ -18,7 +19,7 @@ namespace System.Reflection.Emit public override int GetHashCode() => Token; - public override bool Equals(object obj) => obj is StringToken st && Equals(st); + public override bool Equals(object? obj) => obj is StringToken st && Equals(st); public bool Equals(StringToken obj) => obj.Token == Token; diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Emit/TypeToken.cs b/src/System.Private.CoreLib/shared/System/Reflection/Emit/TypeToken.cs index da8a5da..303716b 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Emit/TypeToken.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Emit/TypeToken.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection.Emit { public struct TypeToken @@ -17,7 +18,7 @@ namespace System.Reflection.Emit public override int GetHashCode() => Token; - public override bool Equals(object obj) => obj is TypeToken tt && Equals(tt); + public override bool Equals(object? obj) => obj is TypeToken tt && Equals(tt); public bool Equals(TypeToken obj) => obj.Token == Token; diff --git a/src/System.Private.CoreLib/shared/System/Reflection/EventAttributes.cs b/src/System.Private.CoreLib/shared/System/Reflection/EventAttributes.cs index fbc2972..b41e84e 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/EventAttributes.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/EventAttributes.cs @@ -5,6 +5,7 @@ // EventAttributes are an enum defining the attributes associated with and Event. // These are defined in CorHdr.h and are a combination of bits and enums. +#nullable enable namespace System.Reflection { [Flags] diff --git a/src/System.Private.CoreLib/shared/System/Reflection/ExceptionHandlingClause.cs b/src/System.Private.CoreLib/shared/System/Reflection/ExceptionHandlingClause.cs index 15780f1..5e753fd 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/ExceptionHandlingClause.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/ExceptionHandlingClause.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Globalization; namespace System.Reflection @@ -15,7 +16,7 @@ namespace System.Reflection public virtual int HandlerOffset => 0; public virtual int HandlerLength => 0; public virtual int FilterOffset => throw new InvalidOperationException(SR.Arg_EHClauseNotFilter); - public virtual Type CatchType => null; + public virtual Type? CatchType => null; public override string ToString() { diff --git a/src/System.Private.CoreLib/shared/System/Reflection/ExceptionHandlingClauseOptions.cs b/src/System.Private.CoreLib/shared/System/Reflection/ExceptionHandlingClauseOptions.cs index 46285f7..30c72e5 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/ExceptionHandlingClauseOptions.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/ExceptionHandlingClauseOptions.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection { [Flags] diff --git a/src/System.Private.CoreLib/shared/System/Reflection/FieldAttributes.cs b/src/System.Private.CoreLib/shared/System/Reflection/FieldAttributes.cs index 048d0e7..90cc482 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/FieldAttributes.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/FieldAttributes.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection { // This Enum matchs the CorFieldAttr defined in CorHdr.h diff --git a/src/System.Private.CoreLib/shared/System/Reflection/GenericParameterAttributes.cs b/src/System.Private.CoreLib/shared/System/Reflection/GenericParameterAttributes.cs index 4b579d2..4cf14a5 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/GenericParameterAttributes.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/GenericParameterAttributes.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection { [Flags] diff --git a/src/System.Private.CoreLib/shared/System/Reflection/ImageFileMachine.cs b/src/System.Private.CoreLib/shared/System/Reflection/ImageFileMachine.cs index 230bc95..425967a 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/ImageFileMachine.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/ImageFileMachine.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection { public enum ImageFileMachine diff --git a/src/System.Private.CoreLib/shared/System/Reflection/InterfaceMapping.cs b/src/System.Private.CoreLib/shared/System/Reflection/InterfaceMapping.cs index 2e0c0d8..ec8b118 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/InterfaceMapping.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/InterfaceMapping.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable // TODO-NULLABLE: Re-review namespace System.Reflection { public struct InterfaceMapping diff --git a/src/System.Private.CoreLib/shared/System/Reflection/MemberTypes.cs b/src/System.Private.CoreLib/shared/System/Reflection/MemberTypes.cs index 57072dc..06823b8 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/MemberTypes.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/MemberTypes.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection { [Flags] @@ -17,4 +18,4 @@ namespace System.Reflection NestedType = 0x80, All = Constructor | Event | Field | Method | Property | TypeInfo | NestedType, } -} \ No newline at end of file +} diff --git a/src/System.Private.CoreLib/shared/System/Reflection/MethodAttributes.cs b/src/System.Private.CoreLib/shared/System/Reflection/MethodAttributes.cs index 1a7c7bf..4448eb5 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/MethodAttributes.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/MethodAttributes.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection { [Flags] diff --git a/src/System.Private.CoreLib/shared/System/Reflection/MethodImplAttributes.cs b/src/System.Private.CoreLib/shared/System/Reflection/MethodImplAttributes.cs index b16f4a4..f46331b 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/MethodImplAttributes.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/MethodImplAttributes.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection { // This Enum matchs the CorMethodImpl defined in CorHdr.h diff --git a/src/System.Private.CoreLib/shared/System/Reflection/ParameterAttributes.cs b/src/System.Private.CoreLib/shared/System/Reflection/ParameterAttributes.cs index ce19589..12cd1f4 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/ParameterAttributes.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/ParameterAttributes.cs @@ -5,6 +5,7 @@ // ParameterAttributes is an enum defining the attributes that may be // associated with a Parameter. These are defined in CorHdr.h. +#nullable enable namespace System.Reflection { // This Enum matchs the CorParamAttr defined in CorHdr.h diff --git a/src/System.Private.CoreLib/shared/System/Reflection/ParameterModifier.cs b/src/System.Private.CoreLib/shared/System/Reflection/ParameterModifier.cs index 0fb75ff..1b9cc08 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/ParameterModifier.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/ParameterModifier.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection { public readonly struct ParameterModifier diff --git a/src/System.Private.CoreLib/shared/System/Reflection/PortableExecutableKinds.cs b/src/System.Private.CoreLib/shared/System/Reflection/PortableExecutableKinds.cs index 79be338..b6427fd 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/PortableExecutableKinds.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/PortableExecutableKinds.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection { [Flags] diff --git a/src/System.Private.CoreLib/shared/System/Reflection/ProcessorArchitecture.cs b/src/System.Private.CoreLib/shared/System/Reflection/ProcessorArchitecture.cs index becb346..a907521 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/ProcessorArchitecture.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/ProcessorArchitecture.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection { public enum ProcessorArchitecture diff --git a/src/System.Private.CoreLib/shared/System/Reflection/PropertyAttributes.cs b/src/System.Private.CoreLib/shared/System/Reflection/PropertyAttributes.cs index 31e7a65..1722fb4 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/PropertyAttributes.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/PropertyAttributes.cs @@ -5,6 +5,7 @@ // PropertyAttributes is an enum which defines the attributes that may be associated // with a property. The values here are defined in Corhdr.h. +#nullable enable namespace System.Reflection { // This Enum matchs the CorPropertyAttr defined in CorHdr.h diff --git a/src/System.Private.CoreLib/shared/System/Reflection/ResourceAttributes.cs b/src/System.Private.CoreLib/shared/System/Reflection/ResourceAttributes.cs index 2d03f42..26f5e75 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/ResourceAttributes.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/ResourceAttributes.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection { [Flags] diff --git a/src/System.Private.CoreLib/shared/System/Reflection/ResourceLocation.cs b/src/System.Private.CoreLib/shared/System/Reflection/ResourceLocation.cs index 4902333..12d8928 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/ResourceLocation.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/ResourceLocation.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection { [Flags] diff --git a/src/System.Private.CoreLib/shared/System/Reflection/TypeAttributes.cs b/src/System.Private.CoreLib/shared/System/Reflection/TypeAttributes.cs index aa30331..e164a29 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/TypeAttributes.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/TypeAttributes.cs @@ -2,8 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Runtime.InteropServices; - +#nullable enable namespace System.Reflection { // This Enum matchs the CorTypeAttr defined in CorHdr.h diff --git a/src/System.Private.CoreLib/src/System/Reflection/INVOCATION_FLAGS.cs b/src/System.Private.CoreLib/src/System/Reflection/INVOCATION_FLAGS.cs index eb28f4e..2cd9c96 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/INVOCATION_FLAGS.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/INVOCATION_FLAGS.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable namespace System.Reflection { // diff --git a/src/System.Private.CoreLib/src/System/Reflection/RuntimeExceptionHandlingClause.cs b/src/System.Private.CoreLib/src/System/Reflection/RuntimeExceptionHandlingClause.cs index eff671e..4d88f48 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/RuntimeExceptionHandlingClause.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/RuntimeExceptionHandlingClause.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Globalization; namespace System.Reflection @@ -11,7 +12,7 @@ namespace System.Reflection // This class can only be created from inside the EE. private RuntimeExceptionHandlingClause() { } - private RuntimeMethodBody _methodBody; + private RuntimeMethodBody _methodBody = null!; private ExceptionHandlingClauseOptions _flags; private int _tryOffset; private int _tryLength; @@ -37,14 +38,14 @@ namespace System.Reflection } } - public override Type CatchType + public override Type? CatchType { get { if (_flags != ExceptionHandlingClauseOptions.Clause) throw new InvalidOperationException(SR.Arg_EHClauseNotClause); - Type type = null; + Type? type = null; if (!MetadataToken.IsNullToken(_catchMetadataToken)) { -- 2.7.4