-
Notifications
You must be signed in to change notification settings - Fork 1.1k
chore: clean up build warnings #7522
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
Changes from 16 commits
07afe8c
ad7d2f4
5e1cfaa
fba25bd
ebb957a
6e36e31
7ef6944
b2f09a6
053ebd9
32dc3a5
90f0548
9618426
94b6d96
5b6dc7e
d87d40b
0103247
5f2a8fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // This file is used by Code Analysis to maintain SuppressMessage | ||
| // attributes that are applied to this project. | ||
| // Project-level suppressions either have no target or are given | ||
| // a specific target and scoped to a namespace, type, member, etc. | ||
|
|
||
| using System.Diagnostics.CodeAnalysis; | ||
|
|
||
| // Suppress CS8632 warnings about nullable reference type annotations | ||
| [assembly: SuppressMessage("Style", "CS8632:The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.", Justification = "Files with #nullable enable directives use nullable annotations correctly")] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ public class XunitAssertions : ITestKitAssertions | |
| /// <param name="args">An optional object array that contains zero or more objects to format.</param> | ||
| public void Fail(string format = "", params object[] args) | ||
| { | ||
| Assert.True(false, string.Format(format, args)); | ||
| Assert.Fail(string.Format(format, args)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cleans up an xUnit warning |
||
| } | ||
|
|
||
| /// <summary> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,7 +44,6 @@ namespace Akka.Coordination | |
| { | ||
| public LeaseTimeoutException(string message) { } | ||
| public LeaseTimeoutException(string message, System.Exception innerEx) { } | ||
| protected LeaseTimeoutException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No inheritors for this class, so this eliminates that warning |
||
| } | ||
| public sealed class LeaseUsageSettings | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,6 @@ | |
| using Xunit; | ||
| using Xunit.Abstractions; | ||
| using FluentAssertions; | ||
| #pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got rid of the warning and fixed the problems instead. These are all related to the test messages themselves so no real impact on Akka.NET. |
||
|
|
||
| namespace Akka.Persistence.Tests | ||
| { | ||
|
|
@@ -217,25 +216,17 @@ public ReqSelection(string message) | |
| } | ||
|
|
||
| [Serializable] | ||
| sealed class ReqAck | ||
| sealed record ReqAck | ||
| { | ||
| public static readonly ReqAck Instance = new(); | ||
| private ReqAck() { } | ||
| public override bool Equals(object obj) | ||
| { | ||
| return obj is ReqAck; | ||
| } | ||
| } | ||
|
|
||
| [Serializable] | ||
| sealed class InvalidReq | ||
| sealed record InvalidReq | ||
| { | ||
| public static readonly InvalidReq Instance = new(); | ||
| private InvalidReq() { } | ||
| public override bool Equals(object obj) | ||
| { | ||
| return obj is InvalidReq; | ||
| } | ||
| } | ||
|
|
||
| interface IEvt { } | ||
|
|
@@ -271,19 +262,7 @@ public AcceptedSelectionReq(string payload, string destinationPath) | |
| } | ||
|
|
||
| [Serializable] | ||
| sealed class ReqDone : IEvt, IEquatable<ReqDone> | ||
| { | ||
| public ReqDone(long id) | ||
| { | ||
| Id = id; | ||
| } | ||
|
|
||
| public long Id { get; private set; } | ||
| public bool Equals(ReqDone other) | ||
| { | ||
| return other != null && other.Id == Id; | ||
| } | ||
| } | ||
| sealed record ReqDone(long Id) : IEvt; | ||
|
|
||
| [Serializable] | ||
| sealed class Action : IEquatable<Action> | ||
|
|
@@ -318,19 +297,7 @@ public override int GetHashCode() | |
| } | ||
|
|
||
| [Serializable] | ||
| sealed class ActionAck : IEquatable<ActionAck> | ||
| { | ||
| public ActionAck(long id) | ||
| { | ||
| Id = id; | ||
| } | ||
|
|
||
| public long Id { get; private set; } | ||
| public bool Equals(ActionAck other) | ||
| { | ||
| return other != null && other.Id == Id; | ||
| } | ||
| } | ||
| sealed record ActionAck(long Id); | ||
|
|
||
| [Serializable] | ||
| sealed class Boom { public static readonly Boom Instance = new(); } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -480,13 +480,15 @@ protected override bool ReceiveCommand(object message) | |
| if (cmd != null) | ||
| { | ||
| Sender.Tell(cmd.Data); | ||
| var events = new List<Evt>(); | ||
| for (int i = 1; i <= 3; i++) | ||
| { | ||
| PersistAsync(new Evt(cmd.Data.ToString() + "-" + (++_counter)), evt => | ||
| { | ||
| Sender.Tell("a" + evt.Data.ToString().Substring(1)); | ||
| }); | ||
| events.Add(new Evt(cmd.Data.ToString() + "-" + (++_counter))); | ||
| } | ||
| PersistAllAsync(events, evt => | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed Akka.NET build warning here |
||
| { | ||
| Sender.Tell("a" + evt.Data.ToString().Substring(1)); | ||
| }); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -312,17 +312,6 @@ protected ScriptedTest(ITestOutputHelper output = null) : base(output) | |
| { | ||
| } | ||
|
|
||
| [Obsolete("Will be removed after async_testkit conversion is done. Use RunScriptAsync instead")] | ||
| protected void RunScript<TIn2, TOut2, TMat2>( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not called anywhere and we should have gotten rid of it in v1.5.0 |
||
| Script<TIn2, TOut2> script, | ||
| ActorMaterializerSettings settings, | ||
| Func<Flow<TIn2, TIn2, NotUsed>, Flow<TIn2, TOut2, TMat2>> op, | ||
| int maximumOverrun = 3, | ||
| int maximumRequest = 3, | ||
| int maximumBuffer = 3) | ||
| => RunScriptAsync(script, settings, op, maximumOverrun, maximumRequest, maximumBuffer) | ||
| .ConfigureAwait(false).GetAwaiter().GetResult(); | ||
|
|
||
| protected async Task RunScriptAsync<TIn2, TOut2, TMat2>( | ||
| Script<TIn2, TOut2> script, | ||
| ActorMaterializerSettings settings, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disables https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/nullable-warnings#configure-nullable-context - which is basically a warning that we have some non-
nullablecode calling code withnullableattributes. We're naturally going to encounter that since we're gradually moving code over to usingnullable- so this cuts down on a fairly large and growing number of warnings.