Browse Source
In `Avalonia.Base`, sealed several classes whose constructors aren't available from public API, and which have no inheritors (#13043 )
* In `Avalonia.Base`, sealed several classes whose constructors aren't available from public API, and which have no inheritors
* un-sealed class that is inherited from
* Made `Delete` method non-virtual
---------
Co-authored-by: Lehonti Ramos <lehonti@ramos>
revert-13066-fixes/13064-logical-scrollable
Lehonti Ramos
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with
31 additions and
31 deletions
src/Avalonia.Base/Animation/Easings/CubicBezierEasing.cs
src/Avalonia.Base/AttachedProperty.cs
src/Avalonia.Base/Data/InstancedBinding.cs
src/Avalonia.Base/Diagnostics/AppliedStyle.cs
src/Avalonia.Base/Diagnostics/AvaloniaPropertyValue.cs
src/Avalonia.Base/Input/GestureRecognizers/VelocityTracker.cs
src/Avalonia.Base/Input/ScrollGestureEventArgs.cs
src/Avalonia.Base/Rendering/Composition/Animations/ExpressionAnimation.cs
src/Avalonia.Base/Rendering/Composition/Animations/ImplicitAnimationCollection.cs
src/Avalonia.Base/Rendering/Composition/Brushes/ServerSimpleCompositionBrush.cs
src/Avalonia.Base/Rendering/Composition/Brushes/ServerSimpleContentBrush.cs
src/Avalonia.Base/Rendering/Composition/Brushes/ServerSimpleImageBrush.cs
src/Avalonia.Base/Rendering/Composition/CompositionCustomVisual.cs
src/Avalonia.Base/Rendering/Composition/CompositionDrawingSurface.cs
src/Avalonia.Base/Rendering/Composition/CompositionPropertySet.cs
src/Avalonia.Base/Rendering/Composition/Server/ServerCustomCompositionVisual.cs
src/Avalonia.Base/Rendering/Composition/Transport/Batch.cs
src/Avalonia.Base/Threading/DispatcherOperation.cs
src/Avalonia.Base/Threading/DispatcherPriorityAwaitable.cs
src/Avalonia.Base/Utilities/Span.cs
src/Avalonia.Base/Utilities/WeakEvent.cs
src/Avalonia.Base/Vector3D.cs
@ -2,7 +2,7 @@ using System;
namespace Avalonia.Animation.Easings ;
public class CubicBezierEasing : IEasing
public sealed class CubicBezierEasing : IEasing
{
private CubicBezier _ bezier ;
//cubic-bezier(0.25, 0.1, 0.25, 1.0)
@ -24,4 +24,4 @@ public class CubicBezierEasing : IEasing
{
return _ bezier . Solve ( progress ) ;
}
}
}
@ -6,7 +6,7 @@ namespace Avalonia
/// An attached avalonia property.
/// </summary>
/// <typeparam name="TValue">The type of the property's value.</typeparam>
public class AttachedProperty < TValue > : StyledProperty < TValue >
public sealed class AttachedProperty < TValue > : StyledProperty < TValue >
{
/// <summary>
/// Initializes a new instance of the <see cref="AttachedProperty{TValue}"/> class.
@ -14,7 +14,7 @@ namespace Avalonia.Data
/// *instanced* by calling <see cref="IBinding.Initiate(AvaloniaObject, AvaloniaProperty, object, bool)"/>
/// on a target object.
/// </remarks>
public class InstancedBinding
public sealed class InstancedBinding
{
/// <summary>
/// Initializes a new instance of the <see cref="InstancedBinding"/> class.
@ -2,7 +2,7 @@
namespace Avalonia.Diagnostics
{
public class AppliedStyle
public sealed class AppliedStyle
{
private readonly IStyleInstance _ instance ;
@ -6,7 +6,7 @@ namespace Avalonia.Diagnostics
/// Holds diagnostic-related information about the value of an <see cref="AvaloniaProperty"/>
/// on an <see cref="AvaloniaObject"/>.
/// </summary>
public class AvaloniaPropertyValue
public sealed class AvaloniaPropertyValue
{
internal AvaloniaPropertyValue (
AvaloniaProperty property ,
@ -194,7 +194,7 @@ namespace Avalonia.Input.GestureRecognizers
}
/// An nth degree polynomial fit to a dataset.
internal class PolynomialFit
internal sealed class PolynomialFit
{
/// Creates a polynomial fit of the given degree.
///
@ -213,7 +213,7 @@ namespace Avalonia.Input.GestureRecognizers
public double Confidence { get ; set ; }
}
internal class LeastSquaresSolver
internal sealed class LeastSquaresSolver
{
private const double PrecisionErrorTolerance = 1e-10 ;
@ -31,7 +31,7 @@ namespace Avalonia.Input
}
}
public class ScrollGestureInertiaStartingEventArgs : RoutedEventArgs
public sealed class ScrollGestureInertiaStartingEventArgs : RoutedEventArgs
{
public int Id { get ; }
public Vector Inertia { get ; }
@ -16,7 +16,7 @@ namespace Avalonia.Rendering.Composition.Animations
/// of Composition objects, mathematical functions and operators and Input.
/// Use the <see cref="CompositionObject.StartAnimation(string , CompositionAnimation)"/> method to start the animation.
/// </remarks>
public class ExpressionAnimation : CompositionAnimation
public sealed class ExpressionAnimation : CompositionAnimation
{
private string? _ expression ;
private Expression ? _ parsedExpression ;
@ -17,7 +17,7 @@ namespace Avalonia.Rendering.Composition.Animations
/// When expression is used in ImplicitAnimationCollection a special keyword `this.FinalValue` will represent
/// the final value of the animated property that was changed
/// </remarks>
public class ImplicitAnimationCollection : CompositionObject , IDictionary < string , ICompositionAnimationBase >
public sealed class ImplicitAnimationCollection : CompositionObject , IDictionary < string , ICompositionAnimationBase >
{
private readonly Dictionary < string , ICompositionAnimationBase > _ inner = new Dictionary < string , ICompositionAnimationBase > ( ) ;
private readonly IDictionary < string , ICompositionAnimationBase > _ innerface ;
@ -14,7 +14,7 @@ namespace Avalonia.Rendering.Composition.Server
ITransform ? IBrush . Transform = > Transform ;
}
class ServerCompositionSimpleGradientBrush : ServerCompositionSimpleBrush , IGradientBrush
internal class ServerCompositionSimpleGradientBrush : ServerCompositionSimpleBrush , IGradientBrush
{
internal ServerCompositionSimpleGradientBrush ( ServerCompositor compositor ) : base ( compositor )
@ -5,7 +5,7 @@ using Avalonia.Rendering.Composition.Transport;
namespace Avalonia.Rendering.Composition.Server ;
internal class ServerCompositionSimpleContentBrush : ServerCompositionSimpleTileBrush , ITileBrush , ISceneBrush
internal sealed class ServerCompositionSimpleContentBrush : ServerCompositionSimpleTileBrush , ITileBrush , ISceneBrush
{
private CompositionRenderDataSceneBrushContent ? _ content ;
@ -21,4 +21,4 @@ internal class ServerCompositionSimpleContentBrush : ServerCompositionSimpleTile
base . DeserializeChangesCore ( reader , committedAt ) ;
_ content = reader . ReadObject < CompositionRenderDataSceneBrushContent ? > ( ) ;
}
}
}
@ -9,7 +9,7 @@ using Avalonia.Utilities;
namespace Avalonia.Rendering.Composition.Server ;
internal class ServerCompositionSimpleImageBrush : ServerCompositionSimpleTileBrush ,
internal sealed class ServerCompositionSimpleImageBrush : ServerCompositionSimpleTileBrush ,
IImageBrush , IImageBrushSource
{
public IImageBrushSource ? Source = > this ;
@ -34,4 +34,4 @@ internal class ServerCompositionSimpleImageBrush : ServerCompositionSimpleTileBr
Bitmap = null ;
Bitmap = reader . ReadObject < IRef < IBitmapImpl > > ( ) ;
}
}
}
@ -5,7 +5,7 @@ using Avalonia.Rendering.Composition.Transport;
namespace Avalonia.Rendering.Composition ;
public class CompositionCustomVisual : CompositionContainerVisual
public sealed class CompositionCustomVisual : CompositionContainerVisual
{
private List < object > ? _ messages ;
@ -34,4 +34,4 @@ public class CompositionCustomVisual : CompositionContainerVisual
_ messages . Clear ( ) ;
}
}
}
}
@ -5,7 +5,7 @@ using Avalonia.Threading;
namespace Avalonia.Rendering.Composition ;
public class CompositionDrawingSurface : CompositionSurface , IDisposable
public sealed class CompositionDrawingSurface : CompositionSurface , IDisposable
{
internal new ServerCompositionDrawingSurface Server = > ( ServerCompositionDrawingSurface ) base . Server ! ;
internal CompositionDrawingSurface ( Compositor compositor ) : base ( compositor , new ServerCompositionDrawingSurface ( compositor . Server ) )
@ -17,7 +17,7 @@ namespace Avalonia.Rendering.Composition
/// <see cref="CompositionPropertySet"/> does not support a delete function – ensure you use <see cref="CompositionPropertySet"/>
/// to store values that will be shared across the application.
/// </summary>
public class CompositionPropertySet : CompositionObject
public sealed class CompositionPropertySet : CompositionObject
{
private readonly Dictionary < string , ExpressionVariant > _ variants = new Dictionary < string , ExpressionVariant > ( ) ;
private readonly Dictionary < string , CompositionObject > _ objects = new Dictionary < string , CompositionObject > ( ) ;
@ -6,7 +6,7 @@ using Avalonia.Rendering.Composition.Transport;
namespace Avalonia.Rendering.Composition.Server ;
internal class ServerCompositionCustomVisual : ServerCompositionContainerVisual , IServerClockItem
internal sealed class ServerCompositionCustomVisual : ServerCompositionContainerVisual , IServerClockItem
{
private readonly CompositionCustomVisualHandler _ handler ;
private bool _ wantsNextAnimationFrameAfterTick ;
@ -9,7 +9,7 @@ namespace Avalonia.Rendering.Composition.Transport
/// <summary>
/// Represents a group of serialized changes from the UI thread to be atomically applied at the render thread
/// </summary>
public class CompositionBatch
public sealed class CompositionBatch
{
private static long _ nextSequenceId = 1 ;
private static readonly ConcurrentBag < BatchStreamData > _ pool = new ( ) ;
@ -176,7 +176,7 @@ public class DispatcherOperation
GetTask ( ) . GetAwaiter ( ) . GetResult ( ) ;
}
private class DispatcherOperationFrame : DispatcherFrame
private sealed class DispatcherOperationFrame : DispatcherFrame
{
// Note: we pass "exitWhenRequested=false" to the base
// DispatcherFrame construsctor because we do not want to exit
@ -373,7 +373,7 @@ public class DispatcherOperation<T> : DispatcherOperation
}
}
internal class SendOrPostCallbackDispatcherOperation : DispatcherOperation
internal sealed class SendOrPostCallbackDispatcherOperation : DispatcherOperation
{
private readonly object? _ arg ;
@ -27,7 +27,7 @@ public class DispatcherPriorityAwaitable : INotifyCompletion
public DispatcherPriorityAwaitable GetAwaiter ( ) = > this ;
}
public class DispatcherPriorityAwaitable < T > : DispatcherPriorityAwaitable
public sealed class DispatcherPriorityAwaitable < T > : DispatcherPriorityAwaitable
{
internal DispatcherPriorityAwaitable ( Dispatcher dispatcher , Task < T > task , DispatcherPriority priority ) : base (
dispatcher , task , priority )
@ -37,4 +37,4 @@ public class DispatcherPriorityAwaitable<T> : DispatcherPriorityAwaitable
public new T GetResult ( ) = > ( ( Task < T > ) Task ) . GetAwaiter ( ) . GetResult ( ) ;
public new DispatcherPriorityAwaitable < T > GetAwaiter ( ) = > this ;
}
}
@ -32,7 +32,7 @@ namespace Avalonia.Utilities
/// <summary>
/// VECTOR: A series of spans
/// </summary>
internal class SpanVector : IEnumerable
internal sealed class SpanVector : IEnumerable
{
private static readonly Equals s_referenceEquals = object . ReferenceEquals ;
private static readonly Equals s_equals = object . Equals ;
@ -67,7 +67,7 @@ namespace Avalonia.Utilities
/// <summary>
/// Delete n elements of vector
/// </summary>
internal virtual v oid Delete ( int index , int count , ref SpanPosition latestPosition )
internal void Delete ( int index , int count , ref SpanPosition latestPosition )
{
DeleteInternal ( index , count ) ;
@ -7,7 +7,7 @@ namespace Avalonia.Utilities;
/// <summary>
/// Manages subscriptions to events using weak listeners.
/// </summary>
public class WeakEvent < TSender , TEventArgs > : WeakEvent where TEventArgs : EventArgs where TSender : class
public sealed class WeakEvent < TSender , TEventArgs > : WeakEvent where TEventArgs : EventArgs where TSender : class
{
private readonly Func < TSender , EventHandler < TEventArgs > , Action > _ subscribe ;
@ -42,7 +42,7 @@ public class WeakEvent<TSender, TEventArgs> : WeakEvent where TEventArgs : Event
subscription . Remove ( subscriber ) ;
}
private class Subscription
private sealed class Subscription
{
private readonly WeakEvent < TSender , TEventArgs > _ ev ;
private readonly TSender _ target ;
@ -142,4 +142,4 @@ public readonly record struct Vector3D(double X, double Y, double Z)
/// Computes the Euclidean distance between the two given points.
/// </summary>
public static double Distance ( Vector3D value1 , Vector3D value2 ) = > Math . Sqrt ( DistanceSquared ( value1 , value2 ) ) ;
}
}