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

Mark private apis as private #11557

Merged
merged 2 commits into from
May 29, 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
10 changes: 10 additions & 0 deletions nukebuild/RefAssemblyGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,16 @@ static void ProcessType(TypeDefinition type, MethodReference obsoleteCtor)
}
}

foreach (var cl in type.NestedTypes)
{
ProcessType(cl, obsoleteCtor);
if (hideMembers)
{
var dflags = TypeAttributes.Public;
cl.Attributes = ((cl.Attributes | dflags) ^ dflags) | TypeAttributes.NotPublic;
}
}

foreach (var m in type.Properties)
MarkAsUnstable(m, obsoleteCtor, forceUnstable);
foreach (var m in type.Events)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

<ItemGroup>
<Compile Include="..\..\src\Avalonia.X11\NativeDialogs\Gtk.cs" Link="NativeControls\Gtk\Gtk.cs" />
<Compile Include="..\..\src\Avalonia.Base\Platform\Interop\Utf8Buffer.cs" Link="NativeControls\Utf8Buffer.cs" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Avalonia.Android
{
internal abstract class InvalidationAwareSurfaceView : SurfaceView, ISurfaceHolderCallback, IPlatformNativeSurfaceHandle
internal abstract class InvalidationAwareSurfaceView : SurfaceView, ISurfaceHolderCallback, INativePlatformHandleSurface
{
bool _invalidateQueued;
readonly object _lock = new object();
Expand Down
4 changes: 4 additions & 0 deletions src/Avalonia.Base/AvaloniaLocator.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
using Avalonia.Metadata;

#pragma warning disable CS1591 // Enable me later

namespace Avalonia
{
[PrivateApi]
public class AvaloniaLocator : IAvaloniaDependencyResolver
{
private readonly IAvaloniaDependencyResolver? _parentScope;
Expand Down Expand Up @@ -114,11 +116,13 @@ public static IDisposable EnterScope()
}
}

[PrivateApi]
public interface IAvaloniaDependencyResolver
{
object? GetService(Type t);
}

[PrivateApi]
public static class LocatorExtensions
{
public static T? GetService<T>(this IAvaloniaDependencyResolver resolver)
Expand Down
2 changes: 2 additions & 0 deletions src/Avalonia.Base/Input/DragDropDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
using Avalonia.VisualTree;
using System.Linq;
using Avalonia.Input.Raw;
using Avalonia.Metadata;

namespace Avalonia.Input
{
[PrivateApi]
public class DragDropDevice : IDragDropDevice
{
public static readonly DragDropDevice Instance = new DragDropDevice();
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Base/Input/IInputDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Avalonia.Input
{
[NotClientImplementable]
[NotClientImplementable, PrivateApi]
public interface IInputDevice
{
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Base/Input/IInputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Avalonia.Input
/// Receives input from the windowing subsystem and dispatches it to interested parties
/// for processing.
/// </summary>
[NotClientImplementable]
[NotClientImplementable, PrivateApi]
public interface IInputManager
{
/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/Avalonia.Base/Input/IKeyboardNavigationHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public interface IKeyboardNavigationHandler
/// <remarks>
/// This method can only be called once, typically by the owner itself on creation.
/// </remarks>
[PrivateApi]
void SetOwner(IInputRoot owner);

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Base/Input/InputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Avalonia.Input
/// Receives input from the windowing subsystem and dispatches it to interested parties
/// for processing.
/// </summary>
public class InputManager : IInputManager
internal class InputManager : IInputManager
{
private readonly LightweightSubject<RawInputEventArgs> _preProcess = new();
private readonly LightweightSubject<RawInputEventArgs> _process = new();
Expand Down
5 changes: 3 additions & 2 deletions src/Avalonia.Base/Input/KeyboardNavigationHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Avalonia.Input
/// Handles keyboard navigation for a window.
/// </summary>
[Unstable]
public class KeyboardNavigationHandler : IKeyboardNavigationHandler
public sealed class KeyboardNavigationHandler : IKeyboardNavigationHandler
{
/// <summary>
/// The window to which the handler belongs.
Expand All @@ -24,6 +24,7 @@ public class KeyboardNavigationHandler : IKeyboardNavigationHandler
/// <remarks>
/// This method can only be called once, typically by the owner itself on creation.
/// </remarks>
[PrivateApi]
public void SetOwner(IInputRoot owner)
{
if (_owner != null)
Expand Down Expand Up @@ -102,7 +103,7 @@ public void Move(
/// </summary>
/// <param name="sender">The event sender.</param>
/// <param name="e">The event args.</param>
protected virtual void OnKeyDown(object? sender, KeyEventArgs e)
void OnKeyDown(object? sender, KeyEventArgs e)
{
if (e.Key == Key.Tab)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Avalonia.Base/Input/Raw/RawDragEvent.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using Avalonia.Metadata;

namespace Avalonia.Input.Raw
{
[PrivateApi]
public class RawDragEvent : RawInputEventArgs
{
public Point Location { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions src/Avalonia.Base/Input/Raw/RawInputEventArgs.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Avalonia.Metadata;

namespace Avalonia.Input.Raw
{
Expand All @@ -11,6 +12,7 @@ namespace Avalonia.Input.Raw
/// pre-processing they are consumed by the relevant <see cref="Device"/> and turned into
/// standard Avalonia events.
/// </remarks>
[PrivateApi]
public class RawInputEventArgs : EventArgs
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions src/Avalonia.Base/Input/Raw/RawKeyEventArgs.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Avalonia.Metadata;

namespace Avalonia.Input.Raw
{
public enum RawKeyEventType
Expand All @@ -6,6 +8,7 @@ public enum RawKeyEventType
KeyUp
}

[PrivateApi]
public class RawKeyEventArgs : RawInputEventArgs
{
public RawKeyEventArgs(
Expand Down
3 changes: 3 additions & 0 deletions src/Avalonia.Base/Input/Raw/RawMouseWheelEventArgs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

using Avalonia.Metadata;

namespace Avalonia.Input.Raw
{
[PrivateApi]
public class RawMouseWheelEventArgs : RawPointerEventArgs
{
public RawMouseWheelEventArgs(
Expand Down
3 changes: 3 additions & 0 deletions src/Avalonia.Base/Input/Raw/RawPointerEventArgs.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Avalonia.Metadata;

namespace Avalonia.Input.Raw
{
Expand Down Expand Up @@ -31,6 +32,7 @@ public enum RawPointerEventType
/// <summary>
/// A raw mouse event.
/// </summary>
[PrivateApi]
public class RawPointerEventArgs : RawInputEventArgs
{
private RawPointerPoint _point;
Expand Down Expand Up @@ -124,6 +126,7 @@ public Point Position
internal IInputElement? InputHitTestResult { get; set; }
}

[PrivateApi]
public record struct RawPointerPoint
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions src/Avalonia.Base/Input/Raw/RawPointerGestureEventArgs.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using Avalonia.Metadata;

namespace Avalonia.Input.Raw
{
[PrivateApi]
public class RawPointerGestureEventArgs : RawPointerEventArgs
{
public RawPointerGestureEventArgs(
Expand Down
2 changes: 2 additions & 0 deletions src/Avalonia.Base/Input/Raw/RawSizeEventArgs.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using Avalonia.Metadata;

namespace Avalonia.Input.Raw
{
[PrivateApi]
public class RawSizeEventArgs : EventArgs
{
public RawSizeEventArgs(Size size)
Expand Down
3 changes: 3 additions & 0 deletions src/Avalonia.Base/Input/Raw/RawTextInputEventArgs.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using Avalonia.Metadata;

namespace Avalonia.Input.Raw
{
[PrivateApi]
public class RawTextInputEventArgs : RawInputEventArgs
{
public RawTextInputEventArgs(
Expand Down
2 changes: 2 additions & 0 deletions src/Avalonia.Base/Input/Raw/RawTouchEventArgs.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using Avalonia.Metadata;

namespace Avalonia.Input.Raw
{
[PrivateApi]
public class RawTouchEventArgs : RawPointerEventArgs
{
public RawTouchEventArgs(IInputDevice device, ulong timestamp, IInputRoot root,
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Base/Media/Brush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void ICompositionRenderResource.AddRefOnCompositor(Compositor c)
OnReferencedFromCompositor(c);
}

protected virtual void OnReferencedFromCompositor(Compositor c)
private protected virtual void OnReferencedFromCompositor(Compositor c)
{
if (Transform is ICompositionRenderResource<ITransform> resource)
resource.AddRefOnCompositor(c);
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Base/Media/DrawingBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public Drawing? Drawing

private InlineDictionary<Compositor, CompositionRenderDataSceneBrushContent?> _renderDataDictionary;

protected override void OnReferencedFromCompositor(Compositor c)
private protected override void OnReferencedFromCompositor(Compositor c)
{
_renderDataDictionary.Add(c, CreateServerContent(c));
base.OnReferencedFromCompositor(c);
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Base/Media/VisualBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public Visual? Visual

private InlineDictionary<Compositor, CompositionRenderDataSceneBrushContent?> _renderDataDictionary;

protected override void OnReferencedFromCompositor(Compositor c)
private protected override void OnReferencedFromCompositor(Compositor c)
{
_renderDataDictionary.Add(c, CreateServerContent(c));
base.OnReferencedFromCompositor(c);
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Base/Metadata/PrivateApiAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Avalonia.Metadata;

[AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Constructor
| AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field)]
| AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Struct)]
public sealed class PrivateApiAttribute : Attribute
{

Expand Down
7 changes: 0 additions & 7 deletions src/Avalonia.Base/Platform/IModuleEnvironmentChecker.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/Avalonia.Base/Platform/IPlatformThreadingInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Avalonia.Platform
/// <summary>
/// Provides platform-specific services relating to threading.
/// </summary>
[Unstable]
[PrivateApi]
public interface IPlatformThreadingInterface
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/Avalonia.Base/Platform/IRenderTarget.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Avalonia.Metadata;
using Avalonia.Rendering;

namespace Avalonia.Platform
Expand All @@ -9,6 +10,7 @@ namespace Avalonia.Platform
/// <remarks>
/// The interface used for obtaining drawing context from surfaces you can render on.
/// </remarks>
[PrivateApi]
public interface IRenderTarget : IDisposable
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

namespace Avalonia.Platform.Interop
{
[Unstable]
public interface IDynamicLibraryLoader
{
IntPtr LoadLibrary(string dll);
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Base/Platform/Interop/Utf8Buffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Avalonia.Platform.Interop
{
public class Utf8Buffer : SafeHandle
internal class Utf8Buffer : SafeHandle
{
private GCHandle _gcHandle;
private byte[]? _data;
Expand Down
2 changes: 2 additions & 0 deletions src/Avalonia.Base/Rendering/DefaultRenderTimer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Avalonia.Metadata;
using Avalonia.Platform;

namespace Avalonia.Rendering
Expand All @@ -10,6 +11,7 @@ namespace Avalonia.Rendering
/// This class may be overridden by platform implementations to use a specialized timer
/// implementation.
/// </remarks>
[PrivateApi]
public class DefaultRenderTimer : IRenderTimer
{
private IRuntimePlatform? _runtime;
Expand Down
Loading