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

sealed some internal classes in Controls.Core that are not inherited from (1) #17669

Merged
merged 4 commits into from
Nov 12, 2023
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
4 changes: 2 additions & 2 deletions src/Controls/src/Core/AnimatableKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Microsoft.Maui.Controls
{
internal class AnimatableKey
internal sealed class AnimatableKey
{
public AnimatableKey(IAnimatable animatable, string handle)
{
Expand Down Expand Up @@ -87,7 +87,7 @@ public override int GetHashCode()
}
}

protected bool Equals(AnimatableKey other)
private bool Equals(AnimatableKey other)
{
if (!string.Equals(Handle, other.Handle, StringComparison.Ordinal))
{
Expand Down
8 changes: 4 additions & 4 deletions src/Controls/src/Core/BindableObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public object GetValue(BindableProperty property)

internal LocalValueEnumerator GetLocalValueEnumerator() => new LocalValueEnumerator(this);

internal class LocalValueEnumerator : IEnumerator<LocalValueEntry>
internal sealed class LocalValueEnumerator : IEnumerator<LocalValueEntry>
{
Dictionary<BindableProperty, BindablePropertyContext>.Enumerator _propertiesEnumerator;
internal LocalValueEnumerator(BindableObject bindableObject) => _propertiesEnumerator = bindableObject._properties.GetEnumerator();
Expand All @@ -190,7 +190,7 @@ void IEnumerator.Reset()
}
}

internal class LocalValueEntry
internal sealed class LocalValueEntry
{
internal LocalValueEntry(BindableProperty property, object value, BindableContextAttributes attributes)
{
Expand Down Expand Up @@ -779,7 +779,7 @@ internal enum BindableContextAttributes
IsDefaultValueCreated = 1 << 5,
}

internal class BindablePropertyContext
internal sealed class BindablePropertyContext
{
public BindableContextAttributes Attributes;

Expand All @@ -801,7 +801,7 @@ internal enum SetValuePrivateFlags
Default = None
}

internal class SetValueArgs
internal sealed class SetValueArgs
{
public readonly SetValueFlags Attributes;
public readonly BindablePropertyContext Context;
Expand Down
8 changes: 4 additions & 4 deletions src/Controls/src/Core/BindingExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace Microsoft.Maui.Controls
{
internal class BindingExpression
internal sealed class BindingExpression
{
internal const string PropertyNotFoundErrorMessage = "'{0}' property not found on '{1}', target property: '{2}.{3}'";
internal const string CannotConvertTypeErrorMessage = "'{0}' cannot be converted to type '{1}'";
Expand Down Expand Up @@ -591,7 +591,7 @@ void OnElementParentSet(object sender, EventArgs e)
}
}

class BindingPair
private sealed class BindingPair
{
public BindingPair(BindingExpressionPart part, object source, bool isLast)
{
Expand All @@ -607,7 +607,7 @@ public BindingPair(BindingExpressionPart part, object source, bool isLast)
public object Source { get; private set; }
}

internal class WeakPropertyChangedProxy : WeakEventProxy<INotifyPropertyChanged, PropertyChangedEventHandler>
internal sealed class WeakPropertyChangedProxy : WeakEventProxy<INotifyPropertyChanged, PropertyChangedEventHandler>
{
public WeakPropertyChangedProxy() { }

Expand Down Expand Up @@ -651,7 +651,7 @@ void OnBCChanged(object sender, EventArgs e)
}
}

class BindingExpressionPart
private sealed class BindingExpressionPart
{
readonly BindingExpression _expression;
readonly PropertyChangedEventHandler _changeHandler;
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/CastingEnumerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Microsoft.Maui.Controls
{
internal class CastingEnumerator<T, TFrom> : IEnumerator<T> where T : class where TFrom : class
internal sealed class CastingEnumerator<T, TFrom> : IEnumerator<T> where T : class where TFrom : class
{
readonly IEnumerator<TFrom> _enumerator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Microsoft.Maui.Controls.Compatibility.Platform.Android
{
[Obsolete]
internal class ResourcesProvider : ISystemResourcesProvider
internal sealed class ResourcesProvider : ISystemResourcesProvider
{
ResourceDictionary _dictionary;
static global::Android.Content.Context _applicationContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Microsoft.Maui.Controls.Handlers.Compatibility
{
internal class ConditionalFocusLayout : LinearLayout, global::Android.Views.View.IOnTouchListener
internal sealed class ConditionalFocusLayout : LinearLayout, global::Android.Views.View.IOnTouchListener
{
public ConditionalFocusLayout(System.IntPtr p, global::Android.Runtime.JniHandleOwnership o) : base(p, o)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
namespace Microsoft.Maui.Controls.Handlers.Compatibility
{

internal class GroupedListViewAdapter : ListViewAdapter, ISectionIndexer
internal sealed class GroupedListViewAdapter : ListViewAdapter, ISectionIndexer
{
class SectionData
private sealed class SectionData
{
public int Index { get; set; }
public int Length { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ void UpdateVerticalScrollBarVisibility()
Control.VerticalScrollBarEnabled = newVerticalScrollVisibility == ScrollBarVisibility.Always;
}

internal class Container : ViewGroup
internal sealed class Container : ViewGroup
{
IPlatformViewHandler _child;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void UpdateMainText()
}

// ensure we don't get other people's BaseCellView's
internal class TextCellView : BaseCellView
internal sealed class TextCellView : BaseCellView
{
public TextCellView(Context context, Cell cell) : base(context, cell)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Microsoft.Maui.Controls.Handlers.Compatibility
{
[Obsolete("Scrolling is now handled by KeyboardAutoManagerScroll.")]
internal class KeyboardInsetTracker : IDisposable
internal sealed class KeyboardInsetTracker : IDisposable
{
readonly Func<UIWindow> _fetchWindow;
readonly Action<PointF> _setContentOffset;
Expand Down