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

[CS0618] AbstractStage Warning Disable #6672

Merged
merged 5 commits into from
May 3, 2023
Merged
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
16 changes: 16 additions & 0 deletions src/core/Akka.Streams/Stage/AbstractStage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ namespace Akka.Streams.Stage
/// <typeparam name="TOut">TBD</typeparam>
internal class PushPullGraphLogic<TIn, TOut> : GraphStageLogic, IDetachedContext<TOut>
{
#pragma warning disable CS0618 // Type or member is obsolete
private AbstractStage<TIn, TOut> _currentStage;
#pragma warning restore CS0618 // Type or member is obsolete
private readonly FlowShape<TIn, TOut> _shape;

/// <summary>
Expand All @@ -30,7 +32,9 @@ internal class PushPullGraphLogic<TIn, TOut> : GraphStageLogic, IDetachedContext
public PushPullGraphLogic(
FlowShape<TIn, TOut> shape,
Attributes attributes,
#pragma warning disable CS0618 // Type or member is obsolete
AbstractStage<TIn, TOut> stage)
#pragma warning restore CS0618 // Type or member is obsolete
: base(shape)
{
Attributes = attributes;
Expand Down Expand Up @@ -59,7 +63,9 @@ public PushPullGraphLogic(
/// <summary>
/// TBD
/// </summary>
#pragma warning disable CS0618 // Type or member is obsolete
public AbstractStage<TIn, TOut> Stage { get; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What stage are we supposed to replace AbstractStage with @eaba ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Please use GraphStage instead. [1.1.2]" @Aaronontheweb

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Obsolete("Please use GraphStage instead. [1.1.2]")]
public abstract class AbstractStage<TIn, TOut> : IStage<TIn, TOut>
{
/// <summary>
/// TBD

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/// <typeparam name="TOut">TBD</typeparam>
[Obsolete("Please use GraphStage instead. [1.1.0]")]
public interface IStage<in TIn, out TOut> { }

#pragma warning restore CS0618 // Type or member is obsolete

IMaterializer ILifecycleContext.Materializer => Materializer;

Expand Down Expand Up @@ -283,7 +289,9 @@ private void OnSupervision(Exception exception)
case Directive.Restart:
ResetAfterSupervise();
_currentStage.PostStop();
#pragma warning disable CS0618 // Type or member is obsolete
_currentStage = (AbstractStage<TIn, TOut>)_currentStage.Restart();
#pragma warning restore CS0618 // Type or member is obsolete
_currentStage.PreStart(Context);
break;
default:
Expand Down Expand Up @@ -316,14 +324,18 @@ public class PushPullGraphStageWithMaterializedValue<TIn, TOut, TMat> : GraphSta
/// <summary>
/// TBD
/// </summary>
#pragma warning disable CS0618 // Type or member is obsolete
public readonly Func<Attributes, (IStage<TIn, TOut>, TMat)> Factory;
#pragma warning restore CS0618 // Type or member is obsolete

/// <summary>
/// TBD
/// </summary>
/// <param name="factory">TBD</param>
/// <param name="stageAttributes">TBD</param>
#pragma warning disable CS0618 // Type or member is obsolete
public PushPullGraphStageWithMaterializedValue(Func<Attributes, (IStage<TIn, TOut>, TMat)> factory, Attributes stageAttributes)
#pragma warning restore CS0618 // Type or member is obsolete
{
InitialAttributes = stageAttributes;
Factory = factory;
Expand All @@ -350,10 +362,12 @@ public PushPullGraphStageWithMaterializedValue(Func<Attributes, (IStage<TIn, TOu
public override ILogicAndMaterializedValue<TMat> CreateLogicAndMaterializedValue(Attributes inheritedAttributes)
{
var stageAndMat = Factory(inheritedAttributes);
#pragma warning disable CS0618 // Type or member is obsolete
return
new LogicAndMaterializedValue<TMat>(
new PushPullGraphLogic<TIn, TOut>(Shape, inheritedAttributes,
(AbstractStage<TIn, TOut>) stageAndMat.Item1), stageAndMat.Item2);
#pragma warning restore CS0618 // Type or member is obsolete
}

/// <summary>
Expand All @@ -376,7 +390,9 @@ public class PushPullGraphStage<TIn, TOut> : PushPullGraphStageWithMaterializedV
/// <param name="factory">TBD</param>
/// <param name="stageAttributes">TBD</param>
/// <returns>TBD</returns>
#pragma warning disable CS0618 // Type or member is obsolete
public PushPullGraphStage(Func<Attributes, IStage<TIn, TOut>> factory, Attributes stageAttributes) : base(attributes => (factory(attributes), NotUsed.Instance), stageAttributes)
#pragma warning restore CS0618 // Type or member is obsolete
{
}
}
Expand Down