Skip to content

Commit cc9c5b5

Browse files
committed
more annotations
1 parent ad35fe4 commit cc9c5b5

12 files changed

Lines changed: 125 additions & 137 deletions

File tree

src/NuGet.Core/NuGet.Packaging/Core/PackageIdentity.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public PackageIdentity(string id, NuGetVersion? version)
4040
/// Package Version
4141
/// </summary>
4242
/// <remarks>can be null</remarks>
43-
/// <remarks>This property is annotated as not nullable intentionally.
43+
/// <remarks>NU_NULL_INC: This property is annotated as not nullable intentionally.
4444
/// The null is used in very few scenarios and practically illegal in cases dealing with an actual package identity. </remarks>
4545
public NuGetVersion Version
4646
{

src/NuGet.Core/NuGet.Packaging/NupkgMetadata/NupkgMetadataFile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class NupkgMetadataFile : IEquatable<NupkgMetadataFile>
1010
{
1111
public int Version { get; set; } = NupkgMetadataFileFormat.Version;
1212

13-
public string? ContentHash { get; set; }
13+
public required string? ContentHash { get; set; }
1414

1515
public string? Source { get; set; }
1616

src/NuGet.Core/NuGet.Packaging/NuspecReader.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -642,11 +642,8 @@ private static List<string> GetFlags(string? flags)
642642
// PERF: Avoid Linq on hot paths
643643
var splitFlags = flags!.Split(CommaArray, StringSplitOptions.RemoveEmptyEntries);
644644

645-
#if NETSTANDARD2_0
646-
var set = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
647-
#elif NET472_OR_GREATER || NET5_0_OR_GREATER
648645
var set = new HashSet<string>(splitFlags.Length, StringComparer.OrdinalIgnoreCase);
649-
#endif
646+
650647
foreach (string flag in splitFlags)
651648
{
652649
set.Add(flag.Trim());

src/NuGet.Core/NuGet.Packaging/PackageExtractor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,7 @@ await logger.LogAsync(
11441144

11451145
if (!string.IsNullOrEmpty(source))
11461146
{
1147-
RepositorySignatureInfoProvider.Instance.TryGetRepositorySignatureInfo(source, out repositorySignatureInfo);
1147+
RepositorySignatureInfoProvider.Instance.TryGetRepositorySignatureInfo(source!, out repositorySignatureInfo);
11481148
}
11491149

11501150
return repositorySignatureInfo;

src/NuGet.Core/NuGet.Packaging/PublicAPI/net472/PublicAPI.Shipped.txt

Lines changed: 55 additions & 55 deletions
Large diffs are not rendered by default.

src/NuGet.Core/NuGet.Packaging/PublicAPI/net8.0/PublicAPI.Shipped.txt

Lines changed: 55 additions & 55 deletions
Large diffs are not rendered by default.

src/NuGet.Core/NuGet.Packaging/Signing/Oids.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
#nullable disable
5-
64
namespace NuGet.Packaging.Signing
75
{
86
public static class Oids

src/NuGet.Core/NuGet.Packaging/Signing/RepositorySignatureInfo.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
#nullable disable
5-
64
using System.Collections.Generic;
75
using NuGet.Packaging.Core;
86

src/NuGet.Core/NuGet.Packaging/Signing/RepositorySignatureInfoProvider.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
#nullable disable
5-
64
using System;
75
using System.Collections.Concurrent;
6+
using System.Diagnostics.CodeAnalysis;
87

98
namespace NuGet.Packaging
109
{
@@ -23,7 +22,7 @@ public class RepositorySignatureInfoProvider
2322
/// <param name="source">Package source URL.</param>
2423
/// <param name="repositorySignatureInfo">Contains the RepositorySignatureInfo when the method returns. It is null if repository signature information is unavailable.</param>
2524
/// <returns>True if the repository signature information was found. Otherwise, False.</returns>
26-
public bool TryGetRepositorySignatureInfo(string source, out RepositorySignatureInfo repositorySignatureInfo)
25+
public bool TryGetRepositorySignatureInfo(string source, [NotNullWhen(returnValue: true)] out RepositorySignatureInfo? repositorySignatureInfo)
2726
{
2827
repositorySignatureInfo = null;
2928

src/NuGet.Core/NuGet.Packaging/Signing/SignatureException.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
#nullable disable
5-
64
using System;
75
using System.Collections.Generic;
86
using NuGet.Common;
@@ -15,9 +13,9 @@ public class SignatureException : PackagingException
1513
/// <summary>
1614
/// Individual trust results.
1715
/// </summary>
18-
public IReadOnlyList<PackageVerificationResult> Results { get; }
16+
public IReadOnlyList<PackageVerificationResult>? Results { get; }
1917

20-
public PackageIdentity PackageIdentity { get; }
18+
public PackageIdentity? PackageIdentity { get; }
2119

2220
public TimeSpan VerifyDuration { get; set; }
2321

0 commit comments

Comments
 (0)