Skip to content

Commit 651a0cb

Browse files
authored
Correctness: Make some private & internal classes sealed where possible (#2559)
1 parent 3bf19a1 commit 651a0cb

File tree

58 files changed

+69
-95
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+69
-95
lines changed

perf/benchmarkapps/Shared/BenchmarkServiceImpl.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
using Grpc.Core;
2121
using Grpc.Testing;
2222

23-
class BenchmarkServiceImpl : BenchmarkService.BenchmarkServiceBase
23+
sealed class BenchmarkServiceImpl : BenchmarkService.BenchmarkServiceBase
2424
{
2525
#if CLIENT_CERTIFICATE_AUTHENTICATION
2626
[Microsoft.AspNetCore.Authorization.Authorize]
@@ -98,4 +98,4 @@ public static SimpleResponse CreateResponse(SimpleRequest request)
9898
var payload = new Payload { Body = body };
9999
return new SimpleResponse { Payload = payload };
100100
}
101-
}
101+
}

src/Grpc.AspNetCore.Server/Internal/CallHandlers/ClientStreamingServerCallHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
namespace Grpc.AspNetCore.Server.Internal.CallHandlers;
2626

27-
internal class ClientStreamingServerCallHandler<[DynamicallyAccessedMembers(GrpcProtocolConstants.ServiceAccessibility)] TService, TRequest, TResponse> : ServerCallHandlerBase<TService, TRequest, TResponse>
27+
internal sealed class ClientStreamingServerCallHandler<[DynamicallyAccessedMembers(GrpcProtocolConstants.ServiceAccessibility)] TService, TRequest, TResponse> : ServerCallHandlerBase<TService, TRequest, TResponse>
2828
where TRequest : class
2929
where TResponse : class
3030
where TService : class

src/Grpc.AspNetCore.Server/Internal/CallHandlers/DuplexStreamingServerCallHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
namespace Grpc.AspNetCore.Server.Internal.CallHandlers;
2525

26-
internal class DuplexStreamingServerCallHandler<[DynamicallyAccessedMembers(GrpcProtocolConstants.ServiceAccessibility)] TService, TRequest, TResponse> : ServerCallHandlerBase<TService, TRequest, TResponse>
26+
internal sealed class DuplexStreamingServerCallHandler<[DynamicallyAccessedMembers(GrpcProtocolConstants.ServiceAccessibility)] TService, TRequest, TResponse> : ServerCallHandlerBase<TService, TRequest, TResponse>
2727
where TRequest : class
2828
where TResponse : class
2929
where TService : class

src/Grpc.AspNetCore.Server/Internal/CallHandlers/ServerStreamingServerCallHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
namespace Grpc.AspNetCore.Server.Internal.CallHandlers;
2525

26-
internal class ServerStreamingServerCallHandler<[DynamicallyAccessedMembers(GrpcProtocolConstants.ServiceAccessibility)] TService, TRequest, TResponse> : ServerCallHandlerBase<TService, TRequest, TResponse>
26+
internal sealed class ServerStreamingServerCallHandler<[DynamicallyAccessedMembers(GrpcProtocolConstants.ServiceAccessibility)] TService, TRequest, TResponse> : ServerCallHandlerBase<TService, TRequest, TResponse>
2727
where TRequest : class
2828
where TResponse : class
2929
where TService : class

src/Grpc.AspNetCore.Server/Internal/CallHandlers/UnaryServerCallHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
namespace Grpc.AspNetCore.Server.Internal.CallHandlers;
2626

27-
internal class UnaryServerCallHandler<[DynamicallyAccessedMembers(GrpcProtocolConstants.ServiceAccessibility)] TService, TRequest, TResponse> : ServerCallHandlerBase<TService, TRequest, TResponse>
27+
internal sealed class UnaryServerCallHandler<[DynamicallyAccessedMembers(GrpcProtocolConstants.ServiceAccessibility)] TService, TRequest, TResponse> : ServerCallHandlerBase<TService, TRequest, TResponse>
2828
where TRequest : class
2929
where TResponse : class
3030
where TService : class

src/Grpc.AspNetCore.Server/Internal/GrpcMarkerService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ namespace Grpc.AspNetCore.Server.Internal;
2424
/// A marker class used to determine if all the required gRPC services were added
2525
/// to the <see cref="IServiceCollection"/>.
2626
/// </summary>
27-
internal class GrpcMarkerService
27+
internal sealed class GrpcMarkerService
2828
{
2929
}

src/Grpc.AspNetCore.Server/Internal/GrpcServerBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
namespace Grpc.AspNetCore.Server.Internal;
2222

23-
internal class GrpcServerBuilder : IGrpcServerBuilder
23+
internal sealed class GrpcServerBuilder : IGrpcServerBuilder
2424
{
2525
public IServiceCollection Services { get; }
2626

src/Grpc.AspNetCore.Server/Internal/GrpcServiceOptionsSetup.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
namespace Grpc.AspNetCore.Server.Internal;
2424

25-
internal class GrpcServiceOptionsSetup : IConfigureOptions<GrpcServiceOptions>
25+
internal sealed class GrpcServiceOptionsSetup : IConfigureOptions<GrpcServiceOptions>
2626
{
2727
// Default to no send limit and 4mb receive limit.
2828
// Matches the gRPC C impl defaults
@@ -45,7 +45,7 @@ public void Configure(GrpcServiceOptions options)
4545
}
4646
}
4747

48-
internal class GrpcServiceOptionsSetup<TService> : IConfigureOptions<GrpcServiceOptions<TService>> where TService : class
48+
internal sealed class GrpcServiceOptionsSetup<TService> : IConfigureOptions<GrpcServiceOptions<TService>> where TService : class
4949
{
5050
private readonly GrpcServiceOptions _options;
5151

src/Grpc.AspNetCore.Server/Internal/HttpContextStreamReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace Grpc.AspNetCore.Server.Internal;
2626

2727
[DebuggerDisplay("{DebuggerToString(),nq}")]
2828
[DebuggerTypeProxy(typeof(HttpContextStreamReader<>.HttpContextStreamReaderDebugView))]
29-
internal class HttpContextStreamReader<TRequest> : IAsyncStreamReader<TRequest> where TRequest : class
29+
internal sealed class HttpContextStreamReader<TRequest> : IAsyncStreamReader<TRequest> where TRequest : class
3030
{
3131
private readonly HttpContextServerCallContext _serverCallContext;
3232
private readonly Func<DeserializationContext, TRequest> _deserializer;

src/Grpc.AspNetCore.Server/Internal/HttpContextStreamWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace Grpc.AspNetCore.Server.Internal;
2626

2727
[DebuggerDisplay("{DebuggerToString(),nq}")]
2828
[DebuggerTypeProxy(typeof(HttpContextStreamWriter<>.HttpContextStreamWriterDebugView))]
29-
internal class HttpContextStreamWriter<TResponse> : IServerStreamWriter<TResponse>
29+
internal sealed class HttpContextStreamWriter<TResponse> : IServerStreamWriter<TResponse>
3030
where TResponse : class
3131
{
3232
private readonly HttpContextServerCallContext _context;

0 commit comments

Comments
 (0)