diff --git a/src/contrib/cluster/Akka.Cluster.Tools/Client/ClusterReceptionist.cs b/src/contrib/cluster/Akka.Cluster.Tools/Client/ClusterReceptionist.cs index 1d54e1e4dea..676a6c3b7aa 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools/Client/ClusterReceptionist.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools/Client/ClusterReceptionist.cs @@ -625,7 +625,7 @@ protected override bool Receive(object message) private bool IsAsk() { var pathElements = _client.Path.Elements; - return pathElements.Count == 2 && pathElements[0] == "temp" && pathElements.Last().StartsWith("$"); + return pathElements.Count == 2 && pathElements[0] == "temp" && pathElements.Last().StartsWith('$'); } } } diff --git a/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedPubSubMediator.cs b/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedPubSubMediator.cs index 61b855504dc..dd58baec2d4 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedPubSubMediator.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/DistributedPubSubMediator.cs @@ -468,7 +468,7 @@ private IEnumerable GetCurrentTopics() if (key.StartsWith(topicPrefix)) { var topic = key.Substring(topicPrefix.Length + 1); - if (!topic.Contains("/")) + if (!topic.Contains('/')) { yield return Uri.EscapeDataString(topic); } diff --git a/src/contrib/cluster/Akka.DistributedData/Replicator.cs b/src/contrib/cluster/Akka.DistributedData/Replicator.cs index c5fc7d51e66..e79a7e19ba0 100644 --- a/src/contrib/cluster/Akka.DistributedData/Replicator.cs +++ b/src/contrib/cluster/Akka.DistributedData/Replicator.cs @@ -394,7 +394,7 @@ public Replicator(ReplicatorSettings settings) var durableWildcardsBuilder = ImmutableHashSet.Empty.ToBuilder(); foreach (var key in settings.DurableKeys) { - if (key.EndsWith("*")) + if (key.EndsWith('*')) durableWildcardsBuilder.Add(key.Substring(0, key.Length - 1)); else durableKeysBuilder.Add(key); diff --git a/src/contrib/persistence/Akka.Persistence.Sql.TestKit/SqlJournalConnectionFailureSpec.cs b/src/contrib/persistence/Akka.Persistence.Sql.TestKit/SqlJournalConnectionFailureSpec.cs index 0708494de32..fb10df8fb75 100644 --- a/src/contrib/persistence/Akka.Persistence.Sql.TestKit/SqlJournalConnectionFailureSpec.cs +++ b/src/contrib/persistence/Akka.Persistence.Sql.TestKit/SqlJournalConnectionFailureSpec.cs @@ -39,7 +39,7 @@ private class ReceiveAnyPersistentActor : TestReceivePersistentActor { public ReceiveAnyPersistentActor(string pid) : base(pid) { - Command(str => str.StartsWith("s"), e => + Command(str => str.StartsWith('s'), e => { Persist(e, h => { diff --git a/src/core/Akka.API.Tests/verify/CoreAPISpec.ApproveCore.DotNet.verified.txt b/src/core/Akka.API.Tests/verify/CoreAPISpec.ApproveCore.DotNet.verified.txt index 8f859a89029..be4cd4277ed 100644 --- a/src/core/Akka.API.Tests/verify/CoreAPISpec.ApproveCore.DotNet.verified.txt +++ b/src/core/Akka.API.Tests/verify/CoreAPISpec.ApproveCore.DotNet.verified.txt @@ -13,8 +13,11 @@ [assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.DistributedData")] [assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.MultiNodeTestRunner.Shared.Tests")] [assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Persistence")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Persistence.Sql.TestKit")] [assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Persistence.TCK")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Persistence.Tests")] [assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Remote")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Remote.TestKit")] [assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Remote.TestKit.Tests")] [assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Remote.Tests")] [assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Remote.Tests.MultiNode")] diff --git a/src/core/Akka.API.Tests/verify/CoreAPISpec.ApproveCore.Net.verified.txt b/src/core/Akka.API.Tests/verify/CoreAPISpec.ApproveCore.Net.verified.txt index 729fd6ce0fe..0b6050c3037 100644 --- a/src/core/Akka.API.Tests/verify/CoreAPISpec.ApproveCore.Net.verified.txt +++ b/src/core/Akka.API.Tests/verify/CoreAPISpec.ApproveCore.Net.verified.txt @@ -13,8 +13,11 @@ [assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.DistributedData")] [assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.MultiNodeTestRunner.Shared.Tests")] [assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Persistence")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Persistence.Sql.TestKit")] [assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Persistence.TCK")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Persistence.Tests")] [assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Remote")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Remote.TestKit")] [assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Remote.TestKit.Tests")] [assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Remote.Tests")] [assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Remote.Tests.MultiNode")] diff --git a/src/core/Akka.Persistence.Tests/EndToEndEventAdapterSpec.cs b/src/core/Akka.Persistence.Tests/EndToEndEventAdapterSpec.cs index 4c23d31d4fe..f943741e057 100644 --- a/src/core/Akka.Persistence.Tests/EndToEndEventAdapterSpec.cs +++ b/src/core/Akka.Persistence.Tests/EndToEndEventAdapterSpec.cs @@ -118,7 +118,7 @@ public object ToJournal(object evt) public IEventSequence FromJournal(object evt, string manifest) { Json m; - if ((m = evt as Json) != null && m.Payload.ToString().StartsWith("a")) + if ((m = evt as Json) != null && m.Payload.ToString().StartsWith('a')) return EventSequence.Single(new A(m.Payload)); else return EventSequence.Empty; @@ -145,7 +145,7 @@ public object ToJournal(object evt) public IEventSequence FromJournal(object evt, string manifest) { Json m; - if ((m = evt as Json) != null && m.Payload.ToString().StartsWith("a")) + if ((m = evt as Json) != null && m.Payload.ToString().StartsWith('a')) return EventSequence.Single(new NewA(m.Payload)); else return EventSequence.Empty; @@ -172,7 +172,7 @@ public object ToJournal(object evt) public IEventSequence FromJournal(object evt, string manifest) { Json m; - if ((m = evt as Json) != null && m.Payload.ToString().StartsWith("b")) + if ((m = evt as Json) != null && m.Payload.ToString().StartsWith('b')) return EventSequence.Single(new B(m.Payload)); else return EventSequence.Empty; @@ -199,7 +199,7 @@ public object ToJournal(object evt) public IEventSequence FromJournal(object evt, string manifest) { Json m; - if ((m = evt as Json) != null && m.Payload.ToString().StartsWith("b")) + if ((m = evt as Json) != null && m.Payload.ToString().StartsWith('b')) return EventSequence.Single(new NewB(m.Payload)); else return EventSequence.Empty; diff --git a/src/core/Akka.Persistence.Tests/PersistenceConfigAutoStartSpec.cs b/src/core/Akka.Persistence.Tests/PersistenceConfigAutoStartSpec.cs index 378921ba31f..61787685de0 100644 --- a/src/core/Akka.Persistence.Tests/PersistenceConfigAutoStartSpec.cs +++ b/src/core/Akka.Persistence.Tests/PersistenceConfigAutoStartSpec.cs @@ -37,7 +37,7 @@ public TestJournal(Config config) _testValue = config.GetString("test-value", null); } - protected override bool AroundReceive(Receive receive, object message) + protected internal override bool AroundReceive(Receive receive, object message) { if (message is TestRequest) { @@ -57,7 +57,7 @@ public TestSnapshotStore(Config config) _testValue = config.GetString("test-value", null); } - protected override bool AroundReceive(Receive receive, object message) + protected internal override bool AroundReceive(Receive receive, object message) { if (message is TestRequest) { diff --git a/src/core/Akka.Persistence.Tests/PersistenceConfigSpec.cs b/src/core/Akka.Persistence.Tests/PersistenceConfigSpec.cs index 4c75f9b5e58..be00057d0bf 100644 --- a/src/core/Akka.Persistence.Tests/PersistenceConfigSpec.cs +++ b/src/core/Akka.Persistence.Tests/PersistenceConfigSpec.cs @@ -37,7 +37,7 @@ public TestJournal(Config config) _testValue = config.GetString("test-value", null); } - protected override bool AroundReceive(Receive receive, object message) + protected internal override bool AroundReceive(Receive receive, object message) { if (message is TestRequest) { @@ -57,7 +57,7 @@ public TestSnapshotStore(Config config) _testValue = config.GetString("test-value", null); } - protected override bool AroundReceive(Receive receive, object message) + protected internal override bool AroundReceive(Receive receive, object message) { if (message is TestRequest) { diff --git a/src/core/Akka.Persistence.Tests/PersistentActorSpec.cs b/src/core/Akka.Persistence.Tests/PersistentActorSpec.cs index c78682c1a16..af3d1eacc33 100644 --- a/src/core/Akka.Persistence.Tests/PersistentActorSpec.cs +++ b/src/core/Akka.Persistence.Tests/PersistentActorSpec.cs @@ -497,8 +497,8 @@ public void PersistentActor_should_allow_multiple_PersistAsyncs_with_nested_Pers pref.Tell("b"); var msgs = ReceiveN(10).Select(m => m.ToString()).ToArray(); - var amsgs = msgs.Where(m => m.StartsWith("a")).ToArray(); - var bmsgs = msgs.Where(m => m.StartsWith("b")).ToArray(); + var amsgs = msgs.Where(m => m.StartsWith('a')).ToArray(); + var bmsgs = msgs.Where(m => m.StartsWith('b')).ToArray(); amsgs.ShouldOnlyContainInOrder("a", "a-outer-1", "a-outer-2", "a-inner-1", "a-inner-2"); bmsgs.ShouldOnlyContainInOrder("b", "b-outer-1", "b-outer-2", "b-inner-1", "b-inner-2"); } diff --git a/src/core/Akka.Persistence.Tests/PersistentActorSpecAsyncAwait.cs b/src/core/Akka.Persistence.Tests/PersistentActorSpecAsyncAwait.cs index f40926e20cb..bbf61ddc521 100644 --- a/src/core/Akka.Persistence.Tests/PersistentActorSpecAsyncAwait.cs +++ b/src/core/Akka.Persistence.Tests/PersistentActorSpecAsyncAwait.cs @@ -496,8 +496,8 @@ public void PersistentActor_should_allow_multiple_PersistAsyncs_with_nested_Pers pref.Tell("b"); var msgs = ReceiveN(10).Select(m => m.ToString()).ToArray(); - var amsgs = msgs.Where(m => m.StartsWith("a")).ToArray(); - var bmsgs = msgs.Where(m => m.StartsWith("b")).ToArray(); + var amsgs = msgs.Where(m => m.StartsWith('a')).ToArray(); + var bmsgs = msgs.Where(m => m.StartsWith('b')).ToArray(); amsgs.ShouldOnlyContainInOrder("a", "a-outer-1", "a-outer-2", "a-inner-1", "a-inner-2"); bmsgs.ShouldOnlyContainInOrder("b", "b-outer-1", "b-outer-2", "b-inner-1", "b-inner-2"); } diff --git a/src/core/Akka.Persistence/AtLeastOnceDelivery.cs b/src/core/Akka.Persistence/AtLeastOnceDelivery.cs index 1ed6553e2a7..7e631819cec 100644 --- a/src/core/Akka.Persistence/AtLeastOnceDelivery.cs +++ b/src/core/Akka.Persistence/AtLeastOnceDelivery.cs @@ -198,7 +198,7 @@ public void Deliver(ActorPath destination, Func deliveryMessageMap /// TBD public void Deliver(ActorSelection destination, Func deliveryMessageMapper) { - var isWildcardSelection = destination.PathString.Contains("*"); + var isWildcardSelection = destination.PathString.Contains('*'); if (isWildcardSelection) throw new NotSupportedException( "Delivering to wildcard actor selections is not supported by AtLeastOnceDelivery. " + diff --git a/src/core/Akka.Persistence/AtLeastOnceDeliveryReceiveActor.cs b/src/core/Akka.Persistence/AtLeastOnceDeliveryReceiveActor.cs index 1371eb4aafb..0addd2a0967 100644 --- a/src/core/Akka.Persistence/AtLeastOnceDeliveryReceiveActor.cs +++ b/src/core/Akka.Persistence/AtLeastOnceDeliveryReceiveActor.cs @@ -178,7 +178,7 @@ public void Deliver(ActorPath destination, Func deliveryMessageMap /// public void Deliver(ActorSelection destination, Func deliveryMessageMapper) { - var isWildcardSelection = destination.PathString.Contains("*"); + var isWildcardSelection = destination.PathString.Contains('*'); if (isWildcardSelection) throw new NotSupportedException( "Delivering to wildcard actor selections is not supported by AtLeastOnceDelivery. " + diff --git a/src/core/Akka.Remote.TestKit/CommandLine.cs b/src/core/Akka.Remote.TestKit/CommandLine.cs index cdf91dc3ba6..b91915a2dff 100644 --- a/src/core/Akka.Remote.TestKit/CommandLine.cs +++ b/src/core/Akka.Remote.TestKit/CommandLine.cs @@ -42,7 +42,7 @@ public static void Initialize(string[] args) var fixedArgs = new List(); for (var i = 1; i < args.Length - 1; ++i) { - if (args[i].Equals("-Dmultinode") && args[i + 1].StartsWith(".")) + if (args[i].Equals("-Dmultinode") && args[i + 1].StartsWith('.')) { fixedArgs.Add(args[i] + args[i+1]); ++i; diff --git a/src/core/Akka.Remote.Tests/Serialization/LruBoundedCacheSpec.cs b/src/core/Akka.Remote.Tests/Serialization/LruBoundedCacheSpec.cs index 1438bd67af1..c603b7756cb 100644 --- a/src/core/Akka.Remote.Tests/Serialization/LruBoundedCacheSpec.cs +++ b/src/core/Akka.Remote.Tests/Serialization/LruBoundedCacheSpec.cs @@ -74,7 +74,7 @@ protected override string Compute(string k) protected override bool IsCacheable(string v) { - return !v.StartsWith("#"); + return !v.StartsWith('#'); } public int InternalProbeDistanceOf(int idealSlot, int actualSlot) diff --git a/src/core/Akka.Streams.Tests/Dsl/FlowGroupBySpec.cs b/src/core/Akka.Streams.Tests/Dsl/FlowGroupBySpec.cs index 476acfaf464..1422d3f8dff 100644 --- a/src/core/Akka.Streams.Tests/Dsl/FlowGroupBySpec.cs +++ b/src/core/Akka.Streams.Tests/Dsl/FlowGroupBySpec.cs @@ -112,7 +112,7 @@ public async Task GroupBy_must_fail_when_key_function_returns_null() await this.AssertAllStagesStoppedAsync(async () => { var source = (Source, NotUsed>)Source.From(new[] { "Aaa", "Abb", "Bcc", "Cdd", "Cee" }) - .GroupBy(3, s => s.StartsWith("A") ? null : s.Substring(0, 1)) + .GroupBy(3, s => s.StartsWith('A') ? null : s.Substring(0, 1)) .Grouped(10) .MergeSubstreams(); var down = source.RunWith(this.SinkProbe>(), Materializer); diff --git a/src/core/Akka.Streams.Tests/Dsl/UnfoldResourceSourceSpec.cs b/src/core/Akka.Streams.Tests/Dsl/UnfoldResourceSourceSpec.cs index 9772dcbb156..e1687b867f8 100644 --- a/src/core/Akka.Streams.Tests/Dsl/UnfoldResourceSourceSpec.cs +++ b/src/core/Akka.Streams.Tests/Dsl/UnfoldResourceSourceSpec.cs @@ -98,14 +98,14 @@ await this.AssertAllStagesStoppedAsync(async() => { public async Task A_UnfoldResourceSource_must_continue_when_strategy_is_resume_and_exception_happened() { await this.AssertAllStagesStoppedAsync(async() => { - var p = Source.UnfoldResource(_open, reader => - { - var s = reader.ReadLine(); - if (s != null && s.Contains("b")) - throw new TestException(""); - return s ?? Option.None; - }, Close) - .WithAttributes(ActorAttributes.CreateSupervisionStrategy(Deciders.ResumingDecider)) + var p = Source.UnfoldResource(_open, reader => + { + var s = reader.ReadLine(); + if (s != null && s.Contains('b')) + throw new TestException(""); + return s ?? Option.None; + }, Close) + .WithAttributes(ActorAttributes.CreateSupervisionStrategy(Deciders.ResumingDecider)) .RunWith(Sink.AsPublisher(false), Materializer); var c = this.CreateManualSubscriberProbe(); @@ -127,14 +127,14 @@ await this.AssertAllStagesStoppedAsync(async() => { public async Task A_UnfoldResourceSource_must_close_and_open_stream_again_when_strategy_is_restart() { await this.AssertAllStagesStoppedAsync(async() => { - var p = Source.UnfoldResource(_open, reader => - { - var s = reader.ReadLine(); - if (s != null && s.Contains("b")) - throw new TestException(""); - return s ?? Option.None; - }, Close) - .WithAttributes(ActorAttributes.CreateSupervisionStrategy(Deciders.RestartingDecider)) + var p = Source.UnfoldResource(_open, reader => + { + var s = reader.ReadLine(); + if (s != null && s.Contains('b')) + throw new TestException(""); + return s ?? Option.None; + }, Close) + .WithAttributes(ActorAttributes.CreateSupervisionStrategy(Deciders.RestartingDecider)) .RunWith(Sink.AsPublisher(false), Materializer); var c = this.CreateManualSubscriberProbe(); diff --git a/src/core/Akka.Streams.Tests/Dsl/WithContextUsageSpec.cs b/src/core/Akka.Streams.Tests/Dsl/WithContextUsageSpec.cs index cf58cb48f68..0f79912ca55 100644 --- a/src/core/Akka.Streams.Tests/Dsl/WithContextUsageSpec.cs +++ b/src/core/Akka.Streams.Tests/Dsl/WithContextUsageSpec.cs @@ -66,7 +66,7 @@ public void Context_propagation_used_for_committing_offsets_must_only_commit_fil { var input = GenInput(0, 10); - Func f = record => record.Key.EndsWith("2"); + Func f = record => record.Key.EndsWith('2'); var expectedOffsets = input.Where(cm => f(cm.Record)).Select(cm => new Offset(cm.Offset.Offset)).ToArray(); expectedOffsets = expectedOffsets.Take(expectedOffsets.Length - 1).ToArray(); diff --git a/src/core/Akka/Actor/ActorPath.cs b/src/core/Akka/Actor/ActorPath.cs index f5116319f51..ef99f15a465 100644 --- a/src/core/Akka/Actor/ActorPath.cs +++ b/src/core/Akka/Actor/ActorPath.cs @@ -106,7 +106,7 @@ public override int GetHashCode() /// TBD public static bool IsValidPathElement(string s) { - return !string.IsNullOrEmpty(s) && !s.StartsWith("$") && Validate(s); + return !string.IsNullOrEmpty(s) && !s.StartsWith('$') && Validate(s); } private static bool IsValidChar(char c) => (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || diff --git a/src/core/Akka/Actor/ActorSelection.cs b/src/core/Akka/Actor/ActorSelection.cs index 54bfe271ab9..cfc37626b9e 100644 --- a/src/core/Akka/Actor/ActorSelection.cs +++ b/src/core/Akka/Actor/ActorSelection.cs @@ -86,11 +86,11 @@ public ActorSelection(IActorRef anchor, IEnumerable elements) case null: case "": break; - case "**": + case "**": list.Add(SelectChildRecursive.Instance); hasDoubleWildcard = true; break; - case string e when e.Contains("?") || e.Contains("*"): + case string e when e.Contains('?') || e.Contains('*'): list.Add(new SelectChildPattern(e)); break; case string and "..": diff --git a/src/core/Akka/Actor/Address.cs b/src/core/Akka/Actor/Address.cs index 8bea0840b37..6cc8d2280d4 100644 --- a/src/core/Akka/Actor/Address.cs +++ b/src/core/Akka/Actor/Address.cs @@ -524,7 +524,7 @@ public static IEnumerable Unapply(string addr) if (!isRelative) return null; var finalAddr = addr; - if (!addr.StartsWith("/")) + if (!addr.StartsWith('/')) { //hack to cause the URI not to explode when we're only given an actor name finalAddr = "/" + addr; diff --git a/src/core/Akka/Properties/AssemblyInfo.cs b/src/core/Akka/Properties/AssemblyInfo.cs index 73fd0b41ef8..33c2de2feab 100644 --- a/src/core/Akka/Properties/AssemblyInfo.cs +++ b/src/core/Akka/Properties/AssemblyInfo.cs @@ -28,6 +28,7 @@ [assembly: InternalsVisibleTo("Akka.TestKit")] [assembly: InternalsVisibleTo("Akka.TestKit.Tests")] [assembly: InternalsVisibleTo("Akka.Remote")] +[assembly: InternalsVisibleTo("Akka.Remote.TestKit")] [assembly: InternalsVisibleTo("Akka.Remote.Tests")] [assembly: InternalsVisibleTo("Akka.Remote.Tests.MultiNode")] [assembly: InternalsVisibleTo("Akka.Remote.TestKit.Tests")] @@ -43,6 +44,8 @@ [assembly: InternalsVisibleTo("Akka.Cluster.Tools")] [assembly: InternalsVisibleTo("Akka.DistributedData")] [assembly: InternalsVisibleTo("Akka.Persistence")] +[assembly: InternalsVisibleTo("Akka.Persistence.Sql.TestKit")] +[assembly: InternalsVisibleTo("Akka.Persistence.Tests")] [assembly: InternalsVisibleTo("Akka.Streams")] [assembly: InternalsVisibleTo("Akka.Streams.Tests")] [assembly: InternalsVisibleTo("Akka.Benchmarks")] diff --git a/src/examples/Chat/ChatClient/Program.cs b/src/examples/Chat/ChatClient/Program.cs index 1138ee00832..df20f600bb3 100644 --- a/src/examples/Chat/ChatClient/Program.cs +++ b/src/examples/Chat/ChatClient/Program.cs @@ -42,7 +42,7 @@ static void Main(string[] args) while (true) { var input = Console.ReadLine(); - if (input.StartsWith("/")) + if (input.StartsWith('/')) { var parts = input.Split(' '); var cmd = parts[0].ToLowerInvariant();