Skip to content

Commit 037b0cb

Browse files
committed
cleanup
1 parent f016fcc commit 037b0cb

7 files changed

Lines changed: 26 additions & 33 deletions

src/NuGet.Core/NuGet.ProjectModel/FileFormatException.cs

Lines changed: 1 addition & 3 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.Globalization;
86
using Newtonsoft.Json;
@@ -22,7 +20,7 @@ public FileFormatException(string message, Exception innerException)
2220
{
2321
}
2422

25-
public string Path { get; private set; }
23+
public string? Path { get; private set; }
2624
public int Line { get; private set; }
2725
public int Column { get; private set; }
2826

src/NuGet.Core/NuGet.ProjectModel/IExternalProjectReferenceProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
namespace NuGet.ProjectModel
88
{
9-
[Obsolete("This API is unused and will be removed in a future release.")]
109
/// <summary>
1110
/// Provides external project reference closures.
1211
/// </summary>
12+
[Obsolete("This API is unused and will be removed in a future release.")]
1313
public interface IExternalProjectReferenceProvider
1414
{
1515
/// <summary>

src/NuGet.Core/NuGet.ProjectModel/JTokenExtensions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
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-
4+
using System;
65
using System.Linq;
76
using Newtonsoft.Json.Linq;
87

98
namespace NuGet.ProjectModel
109
{
10+
[Obsolete("This class is unused and will be removed in a future release.")]
1111
public static class JTokenExtensions
1212
{
13-
public static T[] ValueAsArray<T>(this JToken jToken)
13+
public static T?[] ValueAsArray<T>(this JToken jToken)
1414
{
1515
return jToken.Select(a => a.Value<T>()).ToArray();
1616
}
1717

18-
public static T[] ValueAsArray<T>(this JToken jToken, string name)
18+
public static T?[]? ValueAsArray<T>(this JToken jToken, string name)
1919
{
2020
return jToken?[name]?.ValueAsArray<T>();
2121
}
2222

23-
public static T GetValue<T>(this JToken token, string name)
23+
public static T? GetValue<T>(this JToken token, string name)
2424
{
2525
if (token == null)
2626
{

src/NuGet.Core/NuGet.ProjectModel/PackageSpecUtility.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;
75
using NuGet.Versioning;
86

src/NuGet.Core/NuGet.ProjectModel/PackagesConfigProjectRestoreMetadata.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 NuGet.Common;
75
using NuGet.Shared;
86

src/NuGet.Core/NuGet.ProjectModel/PublicAPI.Shipped.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ NuGet.ProjectModel.ExternalProjectReference
8383
~NuGet.ProjectModel.ExternalProjectReference.UniqueName.get -> string
8484
NuGet.ProjectModel.FileFormatException
8585
NuGet.ProjectModel.FileFormatException.Column.get -> int
86-
~NuGet.ProjectModel.FileFormatException.FileFormatException(string message) -> void
87-
~NuGet.ProjectModel.FileFormatException.FileFormatException(string message, System.Exception innerException) -> void
86+
NuGet.ProjectModel.FileFormatException.FileFormatException(string! message) -> void
87+
NuGet.ProjectModel.FileFormatException.FileFormatException(string! message, System.Exception! innerException) -> void
8888
NuGet.ProjectModel.FileFormatException.Line.get -> int
89-
~NuGet.ProjectModel.FileFormatException.Path.get -> string
89+
NuGet.ProjectModel.FileFormatException.Path.get -> string?
9090
NuGet.ProjectModel.HashObjectWriter
9191
NuGet.ProjectModel.HashObjectWriter.Dispose() -> void
9292
NuGet.ProjectModel.HashObjectWriter.GetHash() -> string!
@@ -115,8 +115,8 @@ NuGet.ProjectModel.IAssetsLogMessage.StartLineNumber.get -> int
115115
~NuGet.ProjectModel.IAssetsLogMessage.TargetGraphs.get -> System.Collections.Generic.IReadOnlyList<string>
116116
NuGet.ProjectModel.IAssetsLogMessage.WarningLevel.get -> NuGet.Common.WarningLevel
117117
NuGet.ProjectModel.IExternalProjectReferenceProvider
118-
~NuGet.ProjectModel.IExternalProjectReferenceProvider.GetEntryPoints() -> System.Collections.Generic.IReadOnlyList<NuGet.ProjectModel.ExternalProjectReference>
119-
~NuGet.ProjectModel.IExternalProjectReferenceProvider.GetReferences(string entryPointPath) -> System.Collections.Generic.IReadOnlyList<NuGet.ProjectModel.ExternalProjectReference>
118+
NuGet.ProjectModel.IExternalProjectReferenceProvider.GetEntryPoints() -> System.Collections.Generic.IReadOnlyList<NuGet.ProjectModel.ExternalProjectReference!>!
119+
NuGet.ProjectModel.IExternalProjectReferenceProvider.GetReferences(string! entryPointPath) -> System.Collections.Generic.IReadOnlyList<NuGet.ProjectModel.ExternalProjectReference!>!
120120
NuGet.ProjectModel.JTokenExtensions
121121
NuGet.ProjectModel.JsonPackageSpecReader
122122
NuGet.ProjectModel.LockFile
@@ -521,12 +521,12 @@ NuGet.ProjectModel.TargetFrameworkInformation.TargetFrameworkInformation() -> vo
521521
NuGet.ProjectModel.TargetFrameworkInformation.Warn.get -> bool
522522
NuGet.ProjectModel.TargetFrameworkInformation.Warn.init -> void
523523
NuGet.ProjectModel.ToolPathResolver
524-
~NuGet.ProjectModel.ToolPathResolver.GetBestToolDirectoryPath(string packageId, NuGet.Versioning.VersionRange versionRange, NuGet.Frameworks.NuGetFramework framework) -> string
525-
~NuGet.ProjectModel.ToolPathResolver.GetLockFilePath(string packageId, NuGet.Versioning.NuGetVersion version, NuGet.Frameworks.NuGetFramework framework) -> string
526-
~NuGet.ProjectModel.ToolPathResolver.GetLockFilePath(string toolDirectory) -> string
527-
~NuGet.ProjectModel.ToolPathResolver.GetToolDirectoryPath(string packageId, NuGet.Versioning.NuGetVersion version, NuGet.Frameworks.NuGetFramework framework) -> string
528-
~NuGet.ProjectModel.ToolPathResolver.ToolPathResolver(string packagesDirectory) -> void
529-
~NuGet.ProjectModel.ToolPathResolver.ToolPathResolver(string packagesDirectory, bool isLowercase) -> void
524+
NuGet.ProjectModel.ToolPathResolver.GetBestToolDirectoryPath(string! packageId, NuGet.Versioning.VersionRange! versionRange, NuGet.Frameworks.NuGetFramework! framework) -> string?
525+
NuGet.ProjectModel.ToolPathResolver.GetLockFilePath(string! packageId, NuGet.Versioning.NuGetVersion! version, NuGet.Frameworks.NuGetFramework! framework) -> string!
526+
NuGet.ProjectModel.ToolPathResolver.GetLockFilePath(string! toolDirectory) -> string!
527+
NuGet.ProjectModel.ToolPathResolver.GetToolDirectoryPath(string! packageId, NuGet.Versioning.NuGetVersion! version, NuGet.Frameworks.NuGetFramework! framework) -> string!
528+
NuGet.ProjectModel.ToolPathResolver.ToolPathResolver(string! packagesDirectory) -> void
529+
NuGet.ProjectModel.ToolPathResolver.ToolPathResolver(string! packagesDirectory, bool isLowercase) -> void
530530
NuGet.ProjectModel.WarningProperties
531531
NuGet.ProjectModel.WarningProperties.AllWarningsAsErrors.get -> bool
532532
NuGet.ProjectModel.WarningProperties.AllWarningsAsErrors.set -> void
@@ -605,11 +605,11 @@ static NuGet.ProjectModel.BuildAction.operator ==(NuGet.ProjectModel.BuildAction
605605
~static NuGet.ProjectModel.DependencyGraphSpec.Load(string path) -> NuGet.ProjectModel.DependencyGraphSpec
606606
~static NuGet.ProjectModel.DependencyGraphSpec.SortPackagesByDependencyOrder(System.Collections.Generic.IEnumerable<NuGet.ProjectModel.PackageSpec> packages) -> System.Collections.Generic.IReadOnlyList<NuGet.ProjectModel.PackageSpec>
607607
~static NuGet.ProjectModel.DependencyGraphSpec.Union(System.Collections.Generic.IEnumerable<NuGet.ProjectModel.DependencyGraphSpec> dgSpecs) -> NuGet.ProjectModel.DependencyGraphSpec
608-
~static NuGet.ProjectModel.FileFormatException.Create(System.Exception exception, Newtonsoft.Json.Linq.JToken value, string path) -> NuGet.ProjectModel.FileFormatException
609-
~static NuGet.ProjectModel.FileFormatException.Create(string message, Newtonsoft.Json.Linq.JToken value, string path) -> NuGet.ProjectModel.FileFormatException
610-
~static NuGet.ProjectModel.JTokenExtensions.GetValue<T>(this Newtonsoft.Json.Linq.JToken token, string name) -> T
611-
~static NuGet.ProjectModel.JTokenExtensions.ValueAsArray<T>(this Newtonsoft.Json.Linq.JToken jToken) -> T[]
612-
~static NuGet.ProjectModel.JTokenExtensions.ValueAsArray<T>(this Newtonsoft.Json.Linq.JToken jToken, string name) -> T[]
608+
static NuGet.ProjectModel.FileFormatException.Create(System.Exception! exception, Newtonsoft.Json.Linq.JToken! value, string! path) -> NuGet.ProjectModel.FileFormatException!
609+
static NuGet.ProjectModel.FileFormatException.Create(string! message, Newtonsoft.Json.Linq.JToken! value, string! path) -> NuGet.ProjectModel.FileFormatException!
610+
static NuGet.ProjectModel.JTokenExtensions.GetValue<T>(this Newtonsoft.Json.Linq.JToken! token, string! name) -> T?
611+
static NuGet.ProjectModel.JTokenExtensions.ValueAsArray<T>(this Newtonsoft.Json.Linq.JToken! jToken) -> T?[]!
612+
static NuGet.ProjectModel.JTokenExtensions.ValueAsArray<T>(this Newtonsoft.Json.Linq.JToken! jToken, string! name) -> T?[]?
613613
~static NuGet.ProjectModel.JsonPackageSpecReader.GetPackageSpec(System.IO.Stream stream, string name, string packageSpecPath, string snapshotValue) -> NuGet.ProjectModel.PackageSpec
614614
~static NuGet.ProjectModel.JsonPackageSpecReader.GetPackageSpec(string json, string name, string packageSpecPath) -> NuGet.ProjectModel.PackageSpec
615615
~static NuGet.ProjectModel.JsonPackageSpecReader.GetPackageSpec(string name, string packageSpecPath) -> NuGet.ProjectModel.PackageSpec

src/NuGet.Core/NuGet.ProjectModel/ToolPathResolver.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
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-
4+
using System;
65
using System.Collections.Generic;
76
using System.IO;
87
using System.Linq;
@@ -23,7 +22,7 @@ public ToolPathResolver(string packagesDirectory)
2322

2423
public ToolPathResolver(string packagesDirectory, bool isLowercase)
2524
{
26-
_packagesDirectory = packagesDirectory;
25+
_packagesDirectory = packagesDirectory ?? throw new ArgumentNullException(nameof(packagesDirectory));
2726
_isLowercase = isLowercase;
2827
}
2928

@@ -81,7 +80,7 @@ private string GetPackagesToolsBasePath()
8180
/// Returns the directory (packagesFolder/.tools/id/version for example) for the best matching version if any.
8281
/// </summary>
8382
/// <returns></returns>
84-
public string GetBestToolDirectoryPath(string packageId, VersionRange versionRange, NuGetFramework framework)
83+
public string? GetBestToolDirectoryPath(string packageId, VersionRange versionRange, NuGetFramework framework)
8584
{
8685
var availableToolVersions = GetAvailableToolVersions(packageId);
8786

0 commit comments

Comments
 (0)