Address follow-up PR feedback on System nullability annotations (#23878)
authorStephen Toub <stoub@microsoft.com>
Wed, 10 Apr 2019 23:12:26 +0000 (19:12 -0400)
committerGitHub <noreply@github.com>
Wed, 10 Apr 2019 23:12:26 +0000 (19:12 -0400)
src/System.Private.CoreLib/shared/System/AppDomain.cs
src/System.Private.CoreLib/shared/System/Array.cs
src/System.Private.CoreLib/shared/System/TimeZoneInfo.cs

index be238e3..b1a2055 100644 (file)
@@ -364,10 +364,10 @@ namespace System
             return Activator.CreateInstanceFrom(assemblyFile, typeName, activationAttributes);
         }
 
-        public object CreateInstanceFromAndUnwrap(string assemblyFile, string typeName)
+        public object? CreateInstanceFromAndUnwrap(string assemblyFile, string typeName)
         {
             ObjectHandle? oh = CreateInstanceFrom(assemblyFile, typeName);
-            return oh?.Unwrap()!; 
+            return oh?.Unwrap();
         }
 
         public object? CreateInstanceFromAndUnwrap(string assemblyFile, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes)
@@ -380,13 +380,13 @@ namespace System
                                                  args, 
                                                  culture, 
                                                  activationAttributes);
-            return oh?.Unwrap()!;
+            return oh?.Unwrap();
         }
 
         public object? CreateInstanceFromAndUnwrap(string assemblyFile, string typeName, object?[]? activationAttributes)
         {
             ObjectHandle? oh = CreateInstanceFrom(assemblyFile, typeName, activationAttributes);            
-            return oh?.Unwrap()!;
+            return oh?.Unwrap();
         }
 
         public IPrincipal? GetThreadPrincipal()
index c851bb4..058f1ca 100644 (file)
@@ -1582,10 +1582,10 @@ namespace System
         private readonly struct SorterObjectArray
         {
             private readonly object[] keys;
-            private readonly object[]? items;
+            private readonly object?[]? items;
             private readonly IComparer comparer;
 
-            internal SorterObjectArray(object[] keys, object[]? items, IComparer comparer)
+            internal SorterObjectArray(object[] keys, object?[]? items, IComparer comparer)
             {
                 this.keys = keys;
                 this.items = items;
@@ -1737,7 +1737,7 @@ namespace System
             private void DownHeap(int i, int n, int lo)
             {
                 object d = keys[lo + i - 1];
-                object dt = (items != null) ? items[lo + i - 1] : null!;
+                object? dt = (items != null) ? items[lo + i - 1] : null;
                 int child;
                 while (i <= n / 2)
                 {
@@ -1761,12 +1761,13 @@ namespace System
             private void InsertionSort(int lo, int hi)
             {
                 int i, j;
-                object t, ti;
+                object t;
+                object? ti;
                 for (i = lo; i < hi; i++)
                 {
                     j = i;
                     t = keys[i + 1];
-                    ti = (items != null) ? items[i + 1] : null!;
+                    ti = (items != null) ? items[i + 1] : null;
                     while (j >= lo && comparer.Compare(t, keys[j]) < 0)
                     {
                         keys[j + 1] = keys[j];
index 9b12adb..3245845 100644 (file)
@@ -961,10 +961,10 @@ namespace System
         public static TimeZoneInfo CreateCustomTimeZone(\r
             string id,\r
             TimeSpan baseUtcOffset,\r
-            string displayName,\r
-            string standardDisplayName,\r
-            string daylightDisplayName,\r
-            AdjustmentRule[] adjustmentRules)\r
+            string? displayName,\r
+            string? standardDisplayName,\r
+            string? daylightDisplayName,\r
+            AdjustmentRule[]? adjustmentRules)\r
         {\r
             return CreateCustomTimeZone(\r
                 id,\r