Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seal internal types in runtime tasks #59935

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/tasks/AotCompilerTask/MonoAOTCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ private static IList<ITaskItem> ConvertAssembliesDictToOrderedList(ConcurrentDic
return outItems;
}

internal class PrecompileArguments
internal sealed class PrecompileArguments
{
public PrecompileArguments(string ResponseFilePath, IDictionary<string, string> EnvironmentVariables, string WorkingDir, ITaskItem AOTAssembly, IList<ProxyFile> ProxyFiles)
{
Expand All @@ -952,7 +952,7 @@ public PrecompileArguments(string ResponseFilePath, IDictionary<string, string>
}
}

internal class FileCache
internal sealed class FileCache
{
private CompilerCache? _newCache;
private CompilerCache? _oldCache;
Expand Down Expand Up @@ -1020,7 +1020,7 @@ public bool Save(string? cacheFilePath)
public ProxyFile NewFile(string targetFile) => new ProxyFile(targetFile, this);
}

internal class ProxyFile
internal sealed class ProxyFile
{
public string TargetFile { get; }
public string TempFile { get; }
Expand Down Expand Up @@ -1093,7 +1093,7 @@ public enum MonoAotModulesTableLanguage
ObjC
}

internal class CompilerCache
internal sealed class CompilerCache
{
public CompilerCache() => FileHashes = new();
public CompilerCache(IDictionary<string, string> oldHashes)
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/AppleAppBuilder/Xcode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public override bool Execute()
}
}

internal class Xcode
internal sealed class Xcode
{
private string RuntimeIdentifier { get; set; }
private string Target { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Microsoft.NET.Build.Tasks
/// Represents an error that is neither avoidable in all cases nor indicative of a bug in this library.
/// It will be logged as a plain build error without the exception type or stack.
/// </summary>
internal class BuildErrorException : Exception
internal sealed class BuildErrorException : Exception
{
public BuildErrorException()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Microsoft.NET.Build.Tasks
{
internal class RuntimeGraphCache
internal sealed class RuntimeGraphCache
{
private IBuildEngine4 _buildEngine;
private Logger _log;
Expand Down
4 changes: 2 additions & 2 deletions src/tasks/WasmAppBuilder/IcallTableGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ private static string GenIcallDecl (Icall icall)
return sb.ToString ();
}

private class Icall : IComparable<Icall>
private sealed class Icall : IComparable<Icall>
{
public Icall (string name, string func, bool handles)
{
Expand All @@ -298,7 +298,7 @@ public int CompareTo (Icall? other) {
}
}

private class IcallClass
private sealed class IcallClass
{
public IcallClass (string name)
{
Expand Down
6 changes: 3 additions & 3 deletions src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ private static bool IsBlittable (Type type)
private static void Error (string msg) => throw new LogAsErrorException(msg);
}

internal class PInvoke : IEquatable<PInvoke>
internal sealed class PInvoke : IEquatable<PInvoke>
{
public PInvoke(string entryPoint, string module, MethodInfo method)
{
Expand All @@ -447,7 +447,7 @@ public bool Equals(PInvoke? other)
public override string ToString() => $"{{ EntryPoint: {EntryPoint}, Module: {Module}, Method: {Method}, Skip: {Skip} }}";
}

internal class PInvokeComparer : IEqualityComparer<PInvoke>
internal sealed class PInvokeComparer : IEqualityComparer<PInvoke>
{
public bool Equals(PInvoke? x, PInvoke? y)
{
Expand All @@ -463,7 +463,7 @@ public int GetHashCode(PInvoke pinvoke)
=> $"{pinvoke.EntryPoint}{pinvoke.Module}{pinvoke.Method}".GetHashCode();
}

internal class PInvokeCallback
internal sealed class PInvokeCallback
{
public PInvokeCallback(MethodInfo method)
{
Expand Down
10 changes: 5 additions & 5 deletions src/tasks/WasmAppBuilder/WasmAppBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class WasmAppBuilder : Task
// </summary>
public ITaskItem[]? ExtraConfig { get; set; }

private class WasmAppConfig
private sealed class WasmAppConfig
{
[JsonPropertyName("assembly_root")]
public string AssemblyRoot { get; set; } = "managed";
Expand All @@ -86,12 +86,12 @@ protected AssetEntry (string name, string behavior)
public string Name { get; init; }
}

private class AssemblyEntry : AssetEntry
private sealed class AssemblyEntry : AssetEntry
{
public AssemblyEntry(string name) : base(name, "assembly") {}
}

private class SatelliteAssemblyEntry : AssetEntry
private sealed class SatelliteAssemblyEntry : AssetEntry
{
public SatelliteAssemblyEntry(string name, string culture) : base(name, "resource")
{
Expand All @@ -102,14 +102,14 @@ public SatelliteAssemblyEntry(string name, string culture) : base(name, "resourc
public string CultureName { get; set; }
}

private class VfsEntry : AssetEntry
private sealed class VfsEntry : AssetEntry
{
public VfsEntry(string name) : base(name, "vfs") {}
[JsonPropertyName("virtual_path")]
public string? VirtualPath { get; set; }
}

private class IcuData : AssetEntry
private sealed class IcuData : AssetEntry
{
public IcuData(string name) : base(name, "icu") {}
[JsonPropertyName("load_remote")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private bool AddAssemblyAndReferences(MetadataLoadContext mlc, Assembly assembly
}
}

internal class SearchPathsAssemblyResolver : MetadataAssemblyResolver
internal sealed class SearchPathsAssemblyResolver : MetadataAssemblyResolver
{
private readonly string[] _searchPaths;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private string FindSubDirIgnoringCase(string parentDir, string dirName)
return first ?? Path.Combine(parentDir, dirName);
}

private record ManifestInformation(
private sealed record ManifestInformation(
object Version,
string Description,

Expand All @@ -207,7 +207,7 @@ private record ManifestInformation(
object Data
);

private record WorkloadInformation(
private sealed record WorkloadInformation(
bool Abstract,
string Kind,
string Description,
Expand All @@ -217,15 +217,15 @@ private record WorkloadInformation(
List<string> Platforms
);

private record PackVersionInformation(
private sealed record PackVersionInformation(
string Kind,
string Version,
[property: JsonPropertyName("alias-to")]
Dictionary<string, string> AliasTo
);
}

internal record PackageReference(string Name,
internal sealed record PackageReference(string Name,
string Version,
string OutputDir,
string relativeSourceDir = "");
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/WorkloadBuildTasks/PackageInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Microsoft.Workload.Build.Tasks
{
internal class PackageInstaller
internal sealed class PackageInstaller
{
private readonly string _tempDir;
private string _nugetConfigContents;
Expand Down