From 32fffec195a1a79ae05c8509de5872705eda4f74 Mon Sep 17 00:00:00 2001 From: Ebere Abanonu Date: Mon, 7 Feb 2022 12:38:23 +0100 Subject: [PATCH 1/2] Fix base docs issue along `Actor` path --- src/core/Akka/Actor/ActorBase.cs | 1 - src/core/Akka/Actor/ActorPath.cs | 8 ------ src/core/Akka/Actor/ActorRef.cs | 10 +++----- src/core/Akka/Actor/ActorSelection.cs | 37 +++++++++++++-------------- src/core/Akka/Actor/ActorSystem.cs | 1 - src/core/Akka/Actor/Address.cs | 6 ++--- 6 files changed, 24 insertions(+), 39 deletions(-) diff --git a/src/core/Akka/Actor/ActorBase.cs b/src/core/Akka/Actor/ActorBase.cs index 0e8c000155e..bdc3bffeb4e 100644 --- a/src/core/Akka/Actor/ActorBase.cs +++ b/src/core/Akka/Actor/ActorBase.cs @@ -79,7 +79,6 @@ public Failure(Exception cause, object state) State = state; } - /// public override string ToString() => State is null ? $"Failure: {Cause}" : $"Failure[{State}]: {Cause}"; } diff --git a/src/core/Akka/Actor/ActorPath.cs b/src/core/Akka/Actor/ActorPath.cs index 8ddc08ec71f..fcd185acb6f 100644 --- a/src/core/Akka/Actor/ActorPath.cs +++ b/src/core/Akka/Actor/ActorPath.cs @@ -64,21 +64,18 @@ public ISurrogated FromSurrogate(ActorSystem system) #region Equality - /// public bool Equals(Surrogate other) { if (other is null) return false; return ReferenceEquals(this, other) || StringComparer.Ordinal.Equals(Path, other.Path); } - /// public bool Equals(ActorPath other) { if (other is null) return false; return StringComparer.Ordinal.Equals(Path, other.ToSerializationFormat()); } - /// public override bool Equals(object obj) { if (obj is null) return false; @@ -87,7 +84,6 @@ public override bool Equals(object obj) return Equals(obj as Surrogate); } - /// public override int GetHashCode() { return Path.GetHashCode(); @@ -262,7 +258,6 @@ internal IReadOnlyList ElementsWithUid [JsonIgnore] public ActorPath Root => ParentOf(0); - /// public bool Equals(ActorPath other) { if (other is null || _depth != other._depth) @@ -290,7 +285,6 @@ public bool Equals(ActorPath other) } } - /// public int CompareTo(ActorPath other) { if (_depth == 0) @@ -613,7 +607,6 @@ public string ToStringWithoutAddress() return Join(ReadOnlySpan.Empty); } - /// public override string ToString() { return Join(_address.ToString().AsSpan()); @@ -650,7 +643,6 @@ public override int GetHashCode() } } - /// public override bool Equals(object obj) { return Equals(obj as ActorPath); diff --git a/src/core/Akka/Actor/ActorRef.cs b/src/core/Akka/Actor/ActorRef.cs index 7208047ff44..b086da905ad 100644 --- a/src/core/Akka/Actor/ActorRef.cs +++ b/src/core/Akka/Actor/ActorRef.cs @@ -284,14 +284,14 @@ public void Tell(object message, IActorRef sender) /// TBD protected abstract void TellInternal(object message, IActorRef sender); - /// + public override string ToString() { if (Path.Uid == ActorCell.UndefinedUid) return $"[{Path}]"; return $"[{Path}#{Path.Uid}]"; } - /// + public override bool Equals(object obj) { if (obj is IActorRef other) @@ -300,7 +300,6 @@ public override bool Equals(object obj) return false; } - /// public override int GetHashCode() { unchecked @@ -312,7 +311,6 @@ public override int GetHashCode() } } - /// /// /// This exception is thrown if the given isn't an . /// @@ -344,7 +342,7 @@ public bool Equals(IActorRef other) && Path.Equals(other.Path); } - /// + public int CompareTo(IActorRef other) { if (other is null) return 1; @@ -901,7 +899,7 @@ public Enumerable(IEnumerator enumerator) _enumerator = enumerator; } - /// + public IEnumerator GetEnumerator() { return _enumerator; diff --git a/src/core/Akka/Actor/ActorSelection.cs b/src/core/Akka/Actor/ActorSelection.cs index a13dcca96e5..f37107e7841 100644 --- a/src/core/Akka/Actor/ActorSelection.cs +++ b/src/core/Akka/Actor/ActorSelection.cs @@ -289,7 +289,6 @@ EmptyLocalActorRef EmptyRef(){ } } - /// public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; @@ -298,13 +297,13 @@ public override bool Equals(object obj) return Equals((ActorSelection)obj); } - /// + protected bool Equals(ActorSelection other) { return Equals(Anchor, other.Anchor) && Equals(PathString, other.PathString); } - /// + public override int GetHashCode() { unchecked @@ -313,7 +312,7 @@ public override int GetHashCode() } } - /// + public override string ToString() { var builder = new StringBuilder(); @@ -358,7 +357,7 @@ public ActorSelectionMessage(object message, SelectionPathElement[] elements, bo /// public bool WildCardFanOut { get; } - /// + public override string ToString() { var elements = string.Join("/", Elements); @@ -405,13 +404,13 @@ public SelectChildName(string name) /// public string Name { get; } - /// + protected bool Equals(SelectChildName other) { return string.Equals(Name, other.Name); } - /// + public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; @@ -420,10 +419,10 @@ public override bool Equals(object obj) return Equals((SelectChildName)obj); } - /// + public override int GetHashCode() => Name?.GetHashCode() ?? 0; - /// + public override string ToString() => Name; } @@ -446,10 +445,10 @@ public SelectChildPattern(string patternStr) /// public string PatternStr { get; } - /// + protected bool Equals(SelectChildPattern other) => string.Equals(PatternStr, other.PatternStr); - /// + public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; @@ -458,16 +457,16 @@ public override bool Equals(object obj) return Equals((SelectChildPattern)obj); } - /// + public override int GetHashCode() => PatternStr?.GetHashCode() ?? 0; - /// + public override string ToString() => PatternStr; } public class SelectChildRecursive : SelectionPathElement { - /// + public override bool Equals(object obj) { if (obj is null) return false; @@ -481,10 +480,10 @@ public override bool Equals(object obj) /// public static readonly SelectChildRecursive Instance = new SelectChildRecursive(); - /// + public override int GetHashCode() => "**".GetHashCode(); - /// + public override string ToString() => "**"; } @@ -499,13 +498,13 @@ public class SelectParent : SelectionPathElement /// public static readonly SelectParent Instance = new SelectParent(); - /// + public override bool Equals(object obj) => !ReferenceEquals(obj, null) && obj is SelectParent; - /// + public override int GetHashCode() => nameof(SelectParent).GetHashCode(); - /// + public override string ToString() => ".."; } } diff --git a/src/core/Akka/Actor/ActorSystem.cs b/src/core/Akka/Actor/ActorSystem.cs index 481aafbd06b..318e0ac6846 100644 --- a/src/core/Akka/Actor/ActorSystem.cs +++ b/src/core/Akka/Actor/ActorSystem.cs @@ -385,7 +385,6 @@ private static ActorSystem CreateAndStartSystem(string name, Config withFallback private bool _isDisposed; //Automatically initialized to false; - /// public void Dispose() { Dispose(true); diff --git a/src/core/Akka/Actor/Address.cs b/src/core/Akka/Actor/Address.cs index 0c5fe5e1ae9..ac0ce7af193 100644 --- a/src/core/Akka/Actor/Address.cs +++ b/src/core/Akka/Actor/Address.cs @@ -135,7 +135,6 @@ public int CompareTo(Address other) return Comparer.Compare(this, other); } - /// public override string ToString() { if (_toString == null) @@ -146,7 +145,7 @@ public override string ToString() return _toString; } - /// + public bool Equals(Address other) { if (ReferenceEquals(null, other)) return false; @@ -154,10 +153,9 @@ public bool Equals(Address other) return Port == other.Port && string.Equals(Host, other.Host) && string.Equals(System, other.System) && string.Equals(Protocol, other.Protocol); } - /// + public override bool Equals(object obj) => Equals(obj as Address); - /// public override int GetHashCode() { unchecked From cd48552fa83eafebc5106e3cf6d5a0275bcab01d Mon Sep 17 00:00:00 2001 From: Ebere Abanonu Date: Mon, 7 Feb 2022 12:39:20 +0100 Subject: [PATCH 2/2] Removed `inheritdoc` --- .../Akka/Actor/Cancellation/Cancelable.cs | 1 - .../ChildrenContainer/Internal/ChildStats.cs | 2 +- src/core/Akka/Actor/Extensions.cs | 4 +-- src/core/Akka/Actor/FSM.cs | 28 +++++++++---------- src/core/Akka/Actor/IAutoReceivedMessage.cs | 18 ++++++------ src/core/Akka/Actor/Inbox.cs | 2 +- src/core/Akka/Actor/LocalActorRef.cs | 8 +++--- src/core/Akka/Actor/Props.cs | 3 +- src/core/Akka/Actor/RemoteScope.cs | 6 ++-- .../Scheduler/HashedWheelTimerScheduler.cs | 1 - src/core/Akka/Actor/Scope.cs | 1 - src/core/Akka/Actor/Settings.cs | 1 - src/core/Akka/Actor/SupervisorStrategy.cs | 11 ++------ 13 files changed, 37 insertions(+), 49 deletions(-) diff --git a/src/core/Akka/Actor/Cancellation/Cancelable.cs b/src/core/Akka/Actor/Cancellation/Cancelable.cs index bfc1e73cbe1..b8680317818 100644 --- a/src/core/Akka/Actor/Cancellation/Cancelable.cs +++ b/src/core/Akka/Actor/Cancellation/Cancelable.cs @@ -187,7 +187,6 @@ private void ThrowIfDisposed() private bool _isDisposed; //Automatically initialized to false; - /// public void Dispose() { Dispose(true); diff --git a/src/core/Akka/Actor/ChildrenContainer/Internal/ChildStats.cs b/src/core/Akka/Actor/ChildrenContainer/Internal/ChildStats.cs index a243c58a91f..4281adc562b 100644 --- a/src/core/Akka/Actor/ChildrenContainer/Internal/ChildStats.cs +++ b/src/core/Akka/Actor/ChildrenContainer/Internal/ChildStats.cs @@ -29,7 +29,7 @@ private ChildNameReserved() {/* Intentionally left blank */} /// TBD /// public static ChildNameReserved Instance { get { return _instance; } } - /// + public override string ToString() { return "Name Reserved"; diff --git a/src/core/Akka/Actor/Extensions.cs b/src/core/Akka/Actor/Extensions.cs index f5d16f09621..b872de681bf 100644 --- a/src/core/Akka/Actor/Extensions.cs +++ b/src/core/Akka/Actor/Extensions.cs @@ -195,13 +195,13 @@ public T Get(ActorSystem system) /// The extension created using the given actor system. public abstract T CreateExtension(ExtendedActorSystem system); - /// + public override bool Equals(object obj) { return obj is T; } - /// + public override int GetHashCode() { return typeof (T).GetHashCode(); diff --git a/src/core/Akka/Actor/FSM.cs b/src/core/Akka/Actor/FSM.cs index c0b71f341f3..9f5cee16670 100644 --- a/src/core/Akka/Actor/FSM.cs +++ b/src/core/Akka/Actor/FSM.cs @@ -58,7 +58,7 @@ private bool Equals(CurrentState other) return Equals(FsmRef, other.FsmRef) && EqualityComparer.Default.Equals(State, other.State); } - /// + public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; @@ -66,7 +66,7 @@ public override bool Equals(object obj) return obj is CurrentState && Equals((CurrentState)obj); } - /// + public override int GetHashCode() { unchecked @@ -75,7 +75,7 @@ public override int GetHashCode() } } - /// + public override string ToString() { return $"CurrentState <{State}>"; @@ -124,7 +124,7 @@ private bool Equals(Transition other) return Equals(FsmRef, other.FsmRef) && EqualityComparer.Default.Equals(From, other.From) && EqualityComparer.Default.Equals(To, other.To); } - /// + public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; @@ -132,7 +132,7 @@ public override bool Equals(object obj) return obj is Transition && Equals((Transition)obj); } - /// + public override int GetHashCode() { unchecked @@ -144,7 +144,7 @@ public override int GetHashCode() } } - /// + public override string ToString() { return $"Transition({From}, {To})"; @@ -249,7 +249,7 @@ public Failure(object cause) /// public object Cause { get; } - /// + public override string ToString() => $"Failure({Cause})"; } @@ -408,7 +408,7 @@ public LogEntry(TS stateName, TD stateData, object fsmEvent) /// public object FsmEvent { get; } - /// + public override string ToString() { return $"StateName: <{StateName}>, StateData: <{StateData}>, FsmEvent: <{FsmEvent}>"; @@ -542,13 +542,13 @@ internal State WithNotification(bool notifies) return new State(StateName, StateData, Timeout, StopReason, Replies, notifies); } - /// + public override string ToString() { return $"{StateName}, {StateData}"; } - /// + public bool Equals(State other) { if (ReferenceEquals(null, other)) return false; @@ -556,7 +556,7 @@ public bool Equals(State other) return EqualityComparer.Default.Equals(StateName, other.StateName) && EqualityComparer.Default.Equals(StateData, other.StateData) && Timeout.Equals(other.Timeout) && Equals(StopReason, other.StopReason) && Equals(Replies, other.Replies); } - /// + public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; @@ -565,7 +565,7 @@ public override bool Equals(object obj) return Equals((State)obj); } - /// + public override int GetHashCode() { unchecked @@ -608,7 +608,7 @@ public Event(object fsmEvent, TD stateData) /// public TD StateData { get; } - /// + public override string ToString() { return $"Event: <{FsmEvent}>, StateData: <{StateData}>"; @@ -650,7 +650,7 @@ public StopEvent(Reason reason, TS terminatedState, TD stateData) /// public TD StateData { get; } - /// + public override string ToString() { return $"Reason: <{Reason}>, TerminatedState: <{TerminatedState}>, StateData: <{StateData}>"; diff --git a/src/core/Akka/Actor/IAutoReceivedMessage.cs b/src/core/Akka/Actor/IAutoReceivedMessage.cs index f99ff94da93..5e814208288 100644 --- a/src/core/Akka/Actor/IAutoReceivedMessage.cs +++ b/src/core/Akka/Actor/IAutoReceivedMessage.cs @@ -109,7 +109,7 @@ private bool Equals(Identify other) return Equals(MessageId, other.MessageId); } - /// + public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; @@ -117,13 +117,13 @@ public override bool Equals(object obj) return obj is Identify && Equals((Identify)obj); } - /// + public override int GetHashCode() { return (MessageId != null ? MessageId.GetHashCode() : 0); } - /// + public override string ToString() { return $": {MessageId}"; @@ -164,7 +164,7 @@ private bool Equals(ActorIdentity other) return Equals(MessageId, other.MessageId) && Equals(Subject, other.Subject); } - /// + public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; @@ -172,7 +172,7 @@ public override bool Equals(object obj) return obj is ActorIdentity && Equals((ActorIdentity)obj); } - /// + public override int GetHashCode() { unchecked @@ -181,7 +181,7 @@ public override int GetHashCode() } } - /// + public override string ToString() { return $": {Subject} - MessageId={MessageId}"; @@ -206,7 +206,7 @@ private PoisonPill() { } /// public static PoisonPill Instance { get; } = new PoisonPill(); - /// + public override string ToString() { return ""; @@ -229,7 +229,7 @@ private Kill() { } /// public static Kill Instance { get; } = new Kill(); - /// + public override string ToString() { return ""; @@ -262,7 +262,7 @@ public AddressTerminated(Address address) /// public Address Address { get; } - /// + public override string ToString() { return $": {Address}"; diff --git a/src/core/Akka/Actor/Inbox.cs b/src/core/Akka/Actor/Inbox.cs index 1b3ce8bed7b..fdcd57a8c3a 100644 --- a/src/core/Akka/Actor/Inbox.cs +++ b/src/core/Akka/Actor/Inbox.cs @@ -557,7 +557,7 @@ public Task ReceiveAsync(TimeSpan timeout) return Receiver.Ask(new Get(_system.Scheduler.MonotonicClock + timeout), Timeout.InfiniteTimeSpan); } - /// + public void Dispose() { Dispose(true); diff --git a/src/core/Akka/Actor/LocalActorRef.cs b/src/core/Akka/Actor/LocalActorRef.cs index 6b6b572acfc..377e0ffece5 100644 --- a/src/core/Akka/Actor/LocalActorRef.cs +++ b/src/core/Akka/Actor/LocalActorRef.cs @@ -92,7 +92,7 @@ protected virtual ActorCell NewActorCell(ActorSystemImpl system, IInternalActorR return new ActorCell(system, self, props, dispatcher, supervisor); } - /// + public override ICell Underlying { get { return _cell; } @@ -104,19 +104,19 @@ public ActorCell Cell get { return _cell; } } - /// + /// public override IActorRefProvider Provider { get { return _cell.SystemImpl.Provider; } } - /// + /// public override IInternalActorRef Parent { get { return _cell.Parent; } } - /// + public override IEnumerable Children { get { return _cell.GetChildren(); } diff --git a/src/core/Akka/Actor/Props.cs b/src/core/Akka/Actor/Props.cs index 53bf294c007..a713bb8d48f 100644 --- a/src/core/Akka/Actor/Props.cs +++ b/src/core/Akka/Actor/Props.cs @@ -319,7 +319,6 @@ private bool CompareArguments(Props other) return true; } - /// public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; @@ -328,7 +327,7 @@ public override bool Equals(object obj) return Equals((Props)obj); } - /// + public override int GetHashCode() { unchecked diff --git a/src/core/Akka/Actor/RemoteScope.cs b/src/core/Akka/Actor/RemoteScope.cs index d57df5690ed..ada5e53935d 100644 --- a/src/core/Akka/Actor/RemoteScope.cs +++ b/src/core/Akka/Actor/RemoteScope.cs @@ -36,7 +36,7 @@ public RemoteScope(Address address) /// public Address Address { get; set; } - /// + public bool Equals(RemoteScope other) { if (ReferenceEquals(null, other)) return false; @@ -44,7 +44,7 @@ public bool Equals(RemoteScope other) return Equals(Address, other.Address); } - /// + public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; @@ -53,7 +53,7 @@ public override bool Equals(object obj) return Equals((RemoteScope) obj); } - /// + public override int GetHashCode() { return (Address != null ? Address.GetHashCode() : 0); diff --git a/src/core/Akka/Actor/Scheduler/HashedWheelTimerScheduler.cs b/src/core/Akka/Actor/Scheduler/HashedWheelTimerScheduler.cs index 5a7a1aa64ed..b08b4360842 100644 --- a/src/core/Akka/Actor/Scheduler/HashedWheelTimerScheduler.cs +++ b/src/core/Akka/Actor/Scheduler/HashedWheelTimerScheduler.cs @@ -370,7 +370,6 @@ private Task> Stop() return Completed; } - /// public void Dispose() { var stopped = Stop(); diff --git a/src/core/Akka/Actor/Scope.cs b/src/core/Akka/Actor/Scope.cs index 21d03db7f55..f93dcde27a1 100644 --- a/src/core/Akka/Actor/Scope.cs +++ b/src/core/Akka/Actor/Scope.cs @@ -37,7 +37,6 @@ public abstract class Scope : IEquatable /// The newly created public abstract Scope Copy(); - /// public virtual bool Equals(Scope other) { if (other == null) return false; diff --git a/src/core/Akka/Actor/Settings.cs b/src/core/Akka/Actor/Settings.cs index 1ecf387cbdc..d976469945b 100644 --- a/src/core/Akka/Actor/Settings.cs +++ b/src/core/Akka/Actor/Settings.cs @@ -391,7 +391,6 @@ public Settings(ActorSystem system, Config config, ActorSystemSetup setup) public bool CoordinatedShutdownRunByActorSystemTerminate { get; private set; } - /// public override string ToString() { return Config.Root.ToString(); diff --git a/src/core/Akka/Actor/SupervisorStrategy.cs b/src/core/Akka/Actor/SupervisorStrategy.cs index 7d2e5d529b4..f4b24ae5e71 100644 --- a/src/core/Akka/Actor/SupervisorStrategy.cs +++ b/src/core/Akka/Actor/SupervisorStrategy.cs @@ -449,7 +449,6 @@ public override ISurrogate ToSurrogate(ActorSystem system) #region Equals - /// public bool Equals(OneForOneStrategy other) { if (ReferenceEquals(other, null)) return false; @@ -460,13 +459,13 @@ public bool Equals(OneForOneStrategy other) Decider.Equals(other.Decider); } - /// + public override bool Equals(object obj) { return Equals(obj as OneForOneStrategy); } - /// + public override int GetHashCode() { unchecked @@ -715,7 +714,6 @@ public override ISurrogate ToSurrogate(ActorSystem system) #region Equals - /// public bool Equals(AllForOneStrategy other) { if (ReferenceEquals(other, null)) return false; @@ -726,13 +724,11 @@ public bool Equals(AllForOneStrategy other) Decider.Equals(other.Decider); } - /// public override bool Equals(object obj) { return Equals(obj as AllForOneStrategy); } - /// public override int GetHashCode() { unchecked @@ -977,7 +973,6 @@ public Directive Decide(Exception cause) return DefaultDirective; } - /// public bool Equals(DeployableDecider other) { if (ReferenceEquals(other, null)) return false; @@ -987,13 +982,11 @@ public bool Equals(DeployableDecider other) Pairs.SequenceEqual(other.Pairs); } - /// public override bool Equals(object obj) { return Equals(obj as DeployableDecider); } - /// public override int GetHashCode() { unchecked