Skip to content

Commit 1998523

Browse files
authored
Address follow-up PR feedback on System nullability annotations (dotnet#23878)
1 parent 9a715fe commit 1998523

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

src/System.Private.CoreLib/shared/System/AppDomain.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,10 @@ public void SetThreadPrincipal(IPrincipal principal)
364364
return Activator.CreateInstanceFrom(assemblyFile, typeName, activationAttributes);
365365
}
366366

367-
public object CreateInstanceFromAndUnwrap(string assemblyFile, string typeName)
367+
public object? CreateInstanceFromAndUnwrap(string assemblyFile, string typeName)
368368
{
369369
ObjectHandle? oh = CreateInstanceFrom(assemblyFile, typeName);
370-
return oh?.Unwrap()!;
370+
return oh?.Unwrap();
371371
}
372372

373373
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 @@ public object CreateInstanceFromAndUnwrap(string assemblyFile, string typeName)
380380
args,
381381
culture,
382382
activationAttributes);
383-
return oh?.Unwrap()!;
383+
return oh?.Unwrap();
384384
}
385385

386386
public object? CreateInstanceFromAndUnwrap(string assemblyFile, string typeName, object?[]? activationAttributes)
387387
{
388388
ObjectHandle? oh = CreateInstanceFrom(assemblyFile, typeName, activationAttributes);
389-
return oh?.Unwrap()!;
389+
return oh?.Unwrap();
390390
}
391391

392392
public IPrincipal? GetThreadPrincipal()

src/System.Private.CoreLib/shared/System/Array.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,10 +1582,10 @@ public static bool TrueForAll<T>(T[] array, Predicate<T> match)
15821582
private readonly struct SorterObjectArray
15831583
{
15841584
private readonly object[] keys;
1585-
private readonly object[]? items;
1585+
private readonly object?[]? items;
15861586
private readonly IComparer comparer;
15871587

1588-
internal SorterObjectArray(object[] keys, object[]? items, IComparer comparer)
1588+
internal SorterObjectArray(object[] keys, object?[]? items, IComparer comparer)
15891589
{
15901590
this.keys = keys;
15911591
this.items = items;
@@ -1737,7 +1737,7 @@ private void Heapsort(int lo, int hi)
17371737
private void DownHeap(int i, int n, int lo)
17381738
{
17391739
object d = keys[lo + i - 1];
1740-
object dt = (items != null) ? items[lo + i - 1] : null!;
1740+
object? dt = (items != null) ? items[lo + i - 1] : null;
17411741
int child;
17421742
while (i <= n / 2)
17431743
{
@@ -1761,12 +1761,13 @@ private void DownHeap(int i, int n, int lo)
17611761
private void InsertionSort(int lo, int hi)
17621762
{
17631763
int i, j;
1764-
object t, ti;
1764+
object t;
1765+
object? ti;
17651766
for (i = lo; i < hi; i++)
17661767
{
17671768
j = i;
17681769
t = keys[i + 1];
1769-
ti = (items != null) ? items[i + 1] : null!;
1770+
ti = (items != null) ? items[i + 1] : null;
17701771
while (j >= lo && comparer.Compare(t, keys[j]) < 0)
17711772
{
17721773
keys[j + 1] = keys[j];

src/System.Private.CoreLib/shared/System/TimeZoneInfo.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -961,10 +961,10 @@ public static TimeZoneInfo CreateCustomTimeZone(
961961
public static TimeZoneInfo CreateCustomTimeZone(
962962
string id,
963963
TimeSpan baseUtcOffset,
964-
string displayName,
965-
string standardDisplayName,
966-
string daylightDisplayName,
967-
AdjustmentRule[] adjustmentRules)
964+
string? displayName,
965+
string? standardDisplayName,
966+
string? daylightDisplayName,
967+
AdjustmentRule[]? adjustmentRules)
968968
{
969969
return CreateCustomTimeZone(
970970
id,

0 commit comments

Comments
 (0)