Skip to content

Commit 16c9993

Browse files
authored
Merge pull request #1378 from dotnet/dev/bartde/seal_things
Seal some types
2 parents 46d83e3 + 647e675 commit 16c9993

File tree

9 files changed

+39
-50
lines changed

9 files changed

+39
-50
lines changed

Rx.NET/Source/src/System.Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.Windows.cs

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

88
namespace System.Reactive.Concurrency
99
{
10-
internal class /*Default*/ConcurrencyAbstractionLayerImpl : IConcurrencyAbstractionLayer
10+
internal sealed class /*Default*/ConcurrencyAbstractionLayerImpl : IConcurrencyAbstractionLayer
1111
{
1212
public IDisposable StartTimer(Action<object?> action, object? state, TimeSpan dueTime)
1313
{

Rx.NET/Source/src/System.Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace System.Reactive.Concurrency
1313
// Another copy is kept in System.Reactive.PlatformServices to enlighten the default lowest common denominator
1414
// behavior of Rx for PLIB when used on a more capable platform.
1515
//
16-
internal class /*Default*/ConcurrencyAbstractionLayerImpl : IConcurrencyAbstractionLayer
16+
internal sealed class /*Default*/ConcurrencyAbstractionLayerImpl : IConcurrencyAbstractionLayer
1717
{
1818
private sealed class WorkItem
1919
{

Rx.NET/Source/src/System.Reactive/Internal/ExceptionServices.Default.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace System.Reactive.PlatformServices
1212
// Another copy is kept in System.Reactive.PlatformServices to enlighten the default lowest common denominator
1313
// behavior of Rx for PLIB when used on a more capable platform.
1414
//
15-
internal class DefaultExceptionServices/*Impl*/ : IExceptionServices
15+
internal sealed class DefaultExceptionServices/*Impl*/ : IExceptionServices
1616
{
1717
#pragma warning disable CS8763 // NB: On down-level platforms, Throw is not marked as DoesNotReturn.
1818
[DoesNotReturn]

Rx.NET/Source/src/System.Reactive/Internal/ExceptionServicesImpl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace System.Reactive.PlatformServices
1212
// Another copy is kept in System.Reactive.PlatformServices to enlighten the default lowest common denominator
1313
// behavior of Rx for PLIB when used on a more capable platform.
1414
//
15-
internal class /*Default*/ExceptionServicesImpl : IExceptionServices
15+
internal sealed class /*Default*/ExceptionServicesImpl : IExceptionServices
1616
{
1717
#pragma warning disable CS8763 // NB: On down-level platforms, Throw is not marked as DoesNotReturn.
1818
[DoesNotReturn]

Rx.NET/Source/src/System.Reactive/Internal/HostLifecycleNotifications.Windows.cs

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

99
namespace System.Reactive.PlatformServices
1010
{
11-
internal class HostLifecycleNotifications : IHostLifecycleNotifications
11+
internal sealed class HostLifecycleNotifications : IHostLifecycleNotifications
1212
{
1313
private EventHandler<SuspendingEventArgs>? _suspending;
1414
private EventHandler<object>? _resuming;

Rx.NET/Source/src/System.Reactive/Joins/ActivePlan.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected void Dequeue()
3636
}
3737
}
3838

39-
internal class ActivePlan<T1> : ActivePlan
39+
internal sealed class ActivePlan<T1> : ActivePlan
4040
{
4141
private readonly Action<T1> _onNext;
4242
private readonly JoinObserver<T1> _first;
@@ -67,7 +67,7 @@ internal override void Match()
6767
}
6868
}
6969

70-
internal class ActivePlan<T1, T2> : ActivePlan
70+
internal sealed class ActivePlan<T1, T2> : ActivePlan
7171
{
7272
private readonly Action<T1, T2> _onNext;
7373
private readonly JoinObserver<T1> _first;
@@ -106,7 +106,7 @@ internal override void Match()
106106
}
107107
}
108108

109-
internal class ActivePlan<T1, T2, T3> : ActivePlan
109+
internal sealed class ActivePlan<T1, T2, T3> : ActivePlan
110110
{
111111
private readonly Action<T1, T2, T3> _onNext;
112112
private readonly JoinObserver<T1> _first;
@@ -152,7 +152,7 @@ internal override void Match()
152152
}
153153
}
154154

155-
internal class ActivePlan<T1, T2, T3, T4> : ActivePlan
155+
internal sealed class ActivePlan<T1, T2, T3, T4> : ActivePlan
156156
{
157157
private readonly Action<T1, T2, T3, T4> _onNext;
158158
private readonly JoinObserver<T1> _first;
@@ -205,7 +205,7 @@ internal override void Match()
205205
}
206206
}
207207

208-
internal class ActivePlan<T1, T2, T3, T4, T5> : ActivePlan
208+
internal sealed class ActivePlan<T1, T2, T3, T4, T5> : ActivePlan
209209
{
210210
private readonly Action<T1, T2, T3, T4, T5> _onNext;
211211
private readonly JoinObserver<T1> _first;
@@ -266,7 +266,7 @@ internal override void Match()
266266
}
267267
}
268268

269-
internal class ActivePlan<T1, T2, T3, T4, T5, T6> : ActivePlan
269+
internal sealed class ActivePlan<T1, T2, T3, T4, T5, T6> : ActivePlan
270270
{
271271
private readonly Action<T1, T2, T3, T4, T5, T6> _onNext;
272272
private readonly JoinObserver<T1> _first;
@@ -335,7 +335,7 @@ internal override void Match()
335335
}
336336
}
337337

338-
internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7> : ActivePlan
338+
internal sealed class ActivePlan<T1, T2, T3, T4, T5, T6, T7> : ActivePlan
339339
{
340340
private readonly Action<T1, T2, T3, T4, T5, T6, T7> _onNext;
341341
private readonly JoinObserver<T1> _first;
@@ -411,7 +411,7 @@ internal override void Match()
411411
}
412412
}
413413

414-
internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8> : ActivePlan
414+
internal sealed class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8> : ActivePlan
415415
{
416416
private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8> _onNext;
417417
private readonly JoinObserver<T1> _first;
@@ -496,7 +496,7 @@ internal override void Match()
496496
}
497497
}
498498

499-
internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9> : ActivePlan
499+
internal sealed class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9> : ActivePlan
500500
{
501501
private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9> _onNext;
502502
private readonly JoinObserver<T1> _first;
@@ -589,7 +589,7 @@ internal override void Match()
589589
}
590590
}
591591

592-
internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> : ActivePlan
592+
internal sealed class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> : ActivePlan
593593
{
594594
private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> _onNext;
595595
private readonly JoinObserver<T1> _first;
@@ -689,7 +689,7 @@ internal override void Match()
689689
}
690690
}
691691

692-
internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> : ActivePlan
692+
internal sealed class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> : ActivePlan
693693
{
694694
private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> _onNext;
695695
private readonly JoinObserver<T1> _first;
@@ -796,7 +796,7 @@ internal override void Match()
796796
}
797797
}
798798

799-
internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> : ActivePlan
799+
internal sealed class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> : ActivePlan
800800
{
801801
private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> _onNext;
802802
private readonly JoinObserver<T1> _first;
@@ -911,7 +911,7 @@ internal override void Match()
911911
}
912912
}
913913

914-
internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> : ActivePlan
914+
internal sealed class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> : ActivePlan
915915
{
916916
private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> _onNext;
917917
private readonly JoinObserver<T1> _first;
@@ -1033,7 +1033,7 @@ internal override void Match()
10331033
}
10341034
}
10351035

1036-
internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> : ActivePlan
1036+
internal sealed class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> : ActivePlan
10371037
{
10381038
private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> _onNext;
10391039
private readonly JoinObserver<T1> _first;
@@ -1162,7 +1162,7 @@ internal override void Match()
11621162
}
11631163
}
11641164

1165-
internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> : ActivePlan
1165+
internal sealed class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> : ActivePlan
11661166
{
11671167
private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> _onNext;
11681168
private readonly JoinObserver<T1> _first;
@@ -1299,7 +1299,7 @@ internal override void Match()
12991299
}
13001300
}
13011301

1302-
internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> : ActivePlan
1302+
internal sealed class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> : ActivePlan
13031303
{
13041304
private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> _onNext;
13051305
private readonly JoinObserver<T1> _first;

Rx.NET/Source/src/System.Reactive/Joins/Plan.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ internal static JoinObserver<TSource> CreateObserver<TSource>(
3838
}
3939
}
4040

41-
internal class Plan<T1, TResult> : Plan<TResult>
41+
internal sealed class Plan<T1, TResult> : Plan<TResult>
4242
{
4343
internal Pattern<T1> Expression { get; }
4444

@@ -83,7 +83,7 @@ internal override ActivePlan Activate(Dictionary<object, IJoinObserver> external
8383
}
8484
}
8585

86-
internal class Plan<T1, T2, TResult> : Plan<TResult>
86+
internal sealed class Plan<T1, T2, TResult> : Plan<TResult>
8787
{
8888
internal Pattern<T1, T2> Expression { get; }
8989

@@ -131,7 +131,7 @@ internal override ActivePlan Activate(Dictionary<object, IJoinObserver> external
131131
}
132132
}
133133

134-
internal class Plan<T1, T2, T3, TResult> : Plan<TResult>
134+
internal sealed class Plan<T1, T2, T3, TResult> : Plan<TResult>
135135
{
136136
internal Pattern<T1, T2, T3> Expression { get; }
137137

@@ -183,7 +183,7 @@ internal override ActivePlan Activate(Dictionary<object, IJoinObserver> external
183183
}
184184
}
185185

186-
internal class Plan<T1, T2, T3, T4, TResult> : Plan<TResult>
186+
internal sealed class Plan<T1, T2, T3, T4, TResult> : Plan<TResult>
187187
{
188188
internal Pattern<T1, T2, T3, T4> Expression { get; }
189189

@@ -238,7 +238,7 @@ internal override ActivePlan Activate(Dictionary<object, IJoinObserver> external
238238
}
239239
}
240240

241-
internal class Plan<T1, T2, T3, T4, T5, TResult> : Plan<TResult>
241+
internal sealed class Plan<T1, T2, T3, T4, T5, TResult> : Plan<TResult>
242242
{
243243
internal Pattern<T1, T2, T3, T4, T5> Expression { get; }
244244

@@ -296,7 +296,7 @@ internal override ActivePlan Activate(Dictionary<object, IJoinObserver> external
296296
}
297297
}
298298

299-
internal class Plan<T1, T2, T3, T4, T5, T6, TResult> : Plan<TResult>
299+
internal sealed class Plan<T1, T2, T3, T4, T5, T6, TResult> : Plan<TResult>
300300
{
301301
internal Pattern<T1, T2, T3, T4, T5, T6> Expression { get; }
302302

@@ -358,7 +358,7 @@ internal override ActivePlan Activate(Dictionary<object, IJoinObserver> external
358358
}
359359
}
360360

361-
internal class Plan<T1, T2, T3, T4, T5, T6, T7, TResult> : Plan<TResult>
361+
internal sealed class Plan<T1, T2, T3, T4, T5, T6, T7, TResult> : Plan<TResult>
362362
{
363363
internal Pattern<T1, T2, T3, T4, T5, T6, T7> Expression { get; }
364364

@@ -423,7 +423,7 @@ internal override ActivePlan Activate(Dictionary<object, IJoinObserver> external
423423
}
424424
}
425425

426-
internal class Plan<T1, T2, T3, T4, T5, T6, T7, T8, TResult> : Plan<TResult>
426+
internal sealed class Plan<T1, T2, T3, T4, T5, T6, T7, T8, TResult> : Plan<TResult>
427427
{
428428
internal Pattern<T1, T2, T3, T4, T5, T6, T7, T8> Expression { get; }
429429

@@ -491,7 +491,7 @@ internal override ActivePlan Activate(Dictionary<object, IJoinObserver> external
491491
}
492492
}
493493

494-
internal class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> : Plan<TResult>
494+
internal sealed class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> : Plan<TResult>
495495
{
496496
internal Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9> Expression { get; }
497497

@@ -562,7 +562,7 @@ internal override ActivePlan Activate(Dictionary<object, IJoinObserver> external
562562
}
563563
}
564564

565-
internal class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> : Plan<TResult>
565+
internal sealed class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> : Plan<TResult>
566566
{
567567
internal Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Expression { get; }
568568

@@ -636,7 +636,7 @@ internal override ActivePlan Activate(Dictionary<object, IJoinObserver> external
636636
}
637637
}
638638

639-
internal class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> : Plan<TResult>
639+
internal sealed class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> : Plan<TResult>
640640
{
641641
internal Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Expression { get; }
642642

@@ -714,7 +714,7 @@ internal override ActivePlan Activate(Dictionary<object, IJoinObserver> external
714714
}
715715
}
716716

717-
internal class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> : Plan<TResult>
717+
internal sealed class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> : Plan<TResult>
718718
{
719719
internal Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Expression { get; }
720720

@@ -797,7 +797,7 @@ internal override ActivePlan Activate(Dictionary<object, IJoinObserver> external
797797
}
798798

799799

800-
internal class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> : Plan<TResult>
800+
internal sealed class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> : Plan<TResult>
801801
{
802802
internal Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Expression { get; }
803803

@@ -883,7 +883,7 @@ internal override ActivePlan Activate(Dictionary<object, IJoinObserver> external
883883
}
884884

885885

886-
internal class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> : Plan<TResult>
886+
internal sealed class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> : Plan<TResult>
887887
{
888888
internal Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Expression { get; }
889889

@@ -975,7 +975,7 @@ internal override ActivePlan Activate(Dictionary<object, IJoinObserver> external
975975
}
976976
}
977977

978-
internal class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> : Plan<TResult>
978+
internal sealed class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> : Plan<TResult>
979979
{
980980
internal Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Expression { get; }
981981

@@ -1069,7 +1069,7 @@ internal override ActivePlan Activate(Dictionary<object, IJoinObserver> external
10691069
return activePlan;
10701070
}
10711071
}
1072-
internal class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> : Plan<TResult>
1072+
internal sealed class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> : Plan<TResult>
10731073
{
10741074
internal Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> Expression { get; }
10751075

Rx.NET/Source/src/System.Reactive/ObservableQuery.cs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,7 @@ IQueryable<TElement> IQueryProvider.CreateQuery<TElement>(Expression expression)
7373

7474
private static MethodInfo? _staticAsQueryable;
7575

76-
private static MethodInfo AsQueryable
77-
{
78-
get
79-
{
80-
if (_staticAsQueryable == null)
81-
{
82-
_staticAsQueryable = Qbservable.InfoOf<object>(() => Queryable.AsQueryable<object>(null)).GetGenericMethodDefinition();
83-
}
84-
85-
return _staticAsQueryable;
86-
}
87-
}
76+
private static MethodInfo AsQueryable => _staticAsQueryable ??= Qbservable.InfoOf<object>(() => Queryable.AsQueryable<object>(null!)).GetGenericMethodDefinition();
8877

8978
IQueryable IQueryProvider.CreateQuery(Expression expression)
9079
{

Rx.NET/Source/src/System.Reactive/Subjects/ConnectableObservable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace System.Reactive.Subjects
1111
/// </summary>
1212
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
1313
/// <typeparam name="TResult">The type of the elements in the resulting sequence, after transformation through the subject.</typeparam>
14-
internal class ConnectableObservable<TSource, TResult> : IConnectableObservable<TResult>
14+
internal sealed class ConnectableObservable<TSource, TResult> : IConnectableObservable<TResult>
1515
{
1616
private readonly ISubject<TSource, TResult> _subject;
1717
private readonly IObservable<TSource> _source;

0 commit comments

Comments
 (0)