Skip to content

Commit 8e694d0

Browse files
committed
Remove JetBrains' annotations for internal classes
The project has Nullable Reference Types feature enabled, so these annotations aren't required anymore for internal classes.
1 parent 3f6587a commit 8e694d0

File tree

6 files changed

+73
-74
lines changed

6 files changed

+73
-74
lines changed

src/Hangfire.InMemory/GlobalConfigurationExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ namespace Hangfire
2626
/// Provides extension methods for global configuration to use <see cref="InMemoryStorage"/>.
2727
/// </summary>
2828
[EditorBrowsable(EditorBrowsableState.Never)]
29+
[SuppressMessage("ReSharper", "RedundantNullnessAttributeWithNullableReferenceTypes", Justification = "Should be used for public classes")]
2930
public static class GlobalConfigurationExtensions
3031
{
3132
/// <summary>

src/Hangfire.InMemory/InMemoryConnection.cs

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
using System.Collections.Generic;
1818
using System.Linq;
1919
using System.Threading;
20-
using Hangfire.Annotations;
2120
using Hangfire.Common;
2221
using Hangfire.InMemory.Entities;
2322
using Hangfire.InMemory.State;
@@ -31,7 +30,7 @@ internal sealed class InMemoryConnection<TKey> : JobStorageConnection
3130
{
3231
private readonly List<LockDisposable> _acquiredLocks = new();
3332

34-
public InMemoryConnection([NotNull] InMemoryStorageOptions options, [NotNull] DispatcherBase<TKey> dispatcher, [NotNull] IKeyProvider<TKey> keyProvider)
33+
public InMemoryConnection(InMemoryStorageOptions options, DispatcherBase<TKey> dispatcher, IKeyProvider<TKey> keyProvider)
3534
{
3635
Options = options ?? throw new ArgumentNullException(nameof(options));
3736
Dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
@@ -57,7 +56,7 @@ public override IWriteOnlyTransaction CreateWriteTransaction()
5756
return new InMemoryTransaction<TKey>(this);
5857
}
5958

60-
public override IDisposable AcquireDistributedLock([NotNull] string resource, TimeSpan timeout)
59+
public override IDisposable AcquireDistributedLock(string resource, TimeSpan timeout)
6160
{
6261
if (resource == null) throw new ArgumentNullException(nameof(resource));
6362

@@ -70,8 +69,8 @@ public override IDisposable AcquireDistributedLock([NotNull] string resource, Ti
7069
}
7170

7271
public override string CreateExpiredJob(
73-
[NotNull] Job job,
74-
[NotNull] IDictionary<string, string?> parameters,
72+
Job job,
73+
IDictionary<string, string?> parameters,
7574
DateTime createdAt,
7675
TimeSpan expireIn)
7776
{
@@ -86,7 +85,7 @@ public override string CreateExpiredJob(
8685
return KeyProvider.ToString(key);
8786
}
8887

89-
public override IFetchedJob FetchNextJob([NotNull] string[] queues, CancellationToken cancellationToken)
88+
public override IFetchedJob FetchNextJob(string[] queues, CancellationToken cancellationToken)
9089
{
9190
if (queues == null) throw new ArgumentNullException(nameof(queues));
9291
if (queues.Length == 0) throw new ArgumentException("Queue array must be non-empty.", nameof(queues));
@@ -158,7 +157,7 @@ private InMemoryFetchedJob<TKey> FetchNextJobSlow(KeyValuePair<string, QueueEntr
158157
}
159158
}
160159

161-
public override void SetJobParameter([NotNull] string id, [NotNull] string name, [CanBeNull] string? value)
160+
public override void SetJobParameter(string id, string name, string? value)
162161
{
163162
if (id == null) throw new ArgumentNullException(nameof(id));
164163
if (name == null) throw new ArgumentNullException(nameof(name));
@@ -171,7 +170,7 @@ public override void SetJobParameter([NotNull] string id, [NotNull] string name,
171170
Dispatcher.QueryWriteAndWait(new Commands<TKey>.JobSetParameter(key, name, value));
172171
}
173172

174-
public override string? GetJobParameter([NotNull] string id, [NotNull] string name)
173+
public override string? GetJobParameter(string id, string name)
175174
{
176175
if (id == null) throw new ArgumentNullException(nameof(id));
177176
if (name == null) throw new ArgumentNullException(nameof(name));
@@ -184,7 +183,7 @@ public override void SetJobParameter([NotNull] string id, [NotNull] string name,
184183
return Dispatcher.QueryReadAndWait(new Queries<TKey>.JobGetParameter(key, name), static (q, s) => q.Execute(s));
185184
}
186185

187-
public override JobData? GetJobData([NotNull] string jobId)
186+
public override JobData? GetJobData(string jobId)
188187
{
189188
if (jobId == null) throw new ArgumentNullException(nameof(jobId));
190189

@@ -209,7 +208,7 @@ public override void SetJobParameter([NotNull] string id, [NotNull] string name,
209208
};
210209
}
211210

212-
public override StateData? GetStateData([NotNull] string jobId)
211+
public override StateData? GetStateData(string jobId)
213212
{
214213
if (jobId == null) throw new ArgumentNullException(nameof(jobId));
215214

@@ -229,7 +228,7 @@ public override void SetJobParameter([NotNull] string id, [NotNull] string name,
229228
};
230229
}
231230

232-
public override void AnnounceServer([NotNull] string serverId, [NotNull] ServerContext context)
231+
public override void AnnounceServer(string serverId, ServerContext context)
233232
{
234233
if (serverId == null) throw new ArgumentNullException(nameof(serverId));
235234
if (context == null) throw new ArgumentNullException(nameof(context));
@@ -238,14 +237,14 @@ public override void AnnounceServer([NotNull] string serverId, [NotNull] ServerC
238237
Dispatcher.QueryWriteAndWait(new Commands<TKey>.ServerAnnounce(serverId, context, now), static (c, s) => c.Execute(s));
239238
}
240239

241-
public override void RemoveServer([NotNull] string serverId)
240+
public override void RemoveServer(string serverId)
242241
{
243242
if (serverId == null) throw new ArgumentNullException(nameof(serverId));
244243

245244
Dispatcher.QueryWriteAndWait(new Commands<TKey>.ServerDelete(serverId), static (c, s) => c.Execute(s));
246245
}
247246

248-
public override void Heartbeat([NotNull] string serverId)
247+
public override void Heartbeat(string serverId)
249248
{
250249
if (serverId == null) throw new ArgumentNullException(nameof(serverId));
251250

@@ -276,14 +275,14 @@ public override DateTime GetUtcDateTime()
276275
}
277276
#endif
278277

279-
public override HashSet<string> GetAllItemsFromSet([NotNull] string key)
278+
public override HashSet<string> GetAllItemsFromSet(string key)
280279
{
281280
if (key == null) throw new ArgumentNullException(nameof(key));
282281

283282
return Dispatcher.QueryReadAndWait(new Queries<TKey>.SortedSetGetAll(key), static (q, s) => q.Execute(s));
284283
}
285284

286-
public override string? GetFirstByLowestScoreFromSet([NotNull] string key, double fromScore, double toScore)
285+
public override string? GetFirstByLowestScoreFromSet(string key, double fromScore, double toScore)
287286
{
288287
if (key == null) throw new ArgumentNullException(nameof(key));
289288
if (toScore < fromScore) throw new ArgumentException("The `toScore` value must be greater or equal to the `fromScore` value.", nameof(toScore));
@@ -293,7 +292,7 @@ public override HashSet<string> GetAllItemsFromSet([NotNull] string key)
293292
static (q, s) => q.Execute(s));
294293
}
295294

296-
public override List<string> GetFirstByLowestScoreFromSet([NotNull] string key, double fromScore, double toScore, int count)
295+
public override List<string> GetFirstByLowestScoreFromSet(string key, double fromScore, double toScore, int count)
297296
{
298297
if (key == null) throw new ArgumentNullException(nameof(key));
299298
if (toScore < fromScore) throw new ArgumentException("The `toScore` value must be greater or equal to the `fromScore` value.", nameof(toScore));
@@ -305,7 +304,7 @@ public override List<string> GetFirstByLowestScoreFromSet([NotNull] string key,
305304
}
306305

307306
#if !HANGFIRE_170
308-
public override bool GetSetContains([NotNull] string key, [NotNull] string value)
307+
public override bool GetSetContains(string key, string value)
309308
{
310309
if (key == null) throw new ArgumentNullException(nameof(key));
311310
if (value == null) throw new ArgumentNullException(nameof(value));
@@ -314,15 +313,15 @@ public override bool GetSetContains([NotNull] string key, [NotNull] string value
314313
}
315314
#endif
316315

317-
public override long GetSetCount([NotNull] string key)
316+
public override long GetSetCount(string key)
318317
{
319318
if (key == null) throw new ArgumentNullException(nameof(key));
320319

321320
return Dispatcher.QueryReadAndWait(new Queries<TKey>.SortedSetCount(key), static (q, s) => q.Execute(s));
322321
}
323322

324323
#if !HANGFIRE_170
325-
public override long GetSetCount([NotNull] IEnumerable<string> keys, int limit)
324+
public override long GetSetCount(IEnumerable<string> keys, int limit)
326325
{
327326
if (keys == null) throw new ArgumentNullException(nameof(keys));
328327
if (limit < 0) throw new ArgumentOutOfRangeException(nameof(limit), "Value must be greater or equal to 0.");
@@ -333,28 +332,28 @@ public override long GetSetCount([NotNull] IEnumerable<string> keys, int limit)
333332
}
334333
#endif
335334

336-
public override long GetListCount([NotNull] string key)
335+
public override long GetListCount(string key)
337336
{
338337
if (key == null) throw new ArgumentNullException(nameof(key));
339338

340339
return Dispatcher.QueryReadAndWait(new Queries<TKey>.ListCount(key), static (q, s) => q.Execute(s));
341340
}
342341

343-
public override long GetCounter([NotNull] string key)
342+
public override long GetCounter(string key)
344343
{
345344
if (key == null) throw new ArgumentNullException(nameof(key));
346345

347346
return Dispatcher.QueryReadAndWait(new Queries<TKey>.CounterGet(key), static (q, s) => q.Execute(s));
348347
}
349348

350-
public override long GetHashCount([NotNull] string key)
349+
public override long GetHashCount(string key)
351350
{
352351
if (key == null) throw new ArgumentNullException(nameof(key));
353352

354353
return Dispatcher.QueryReadAndWait(new Queries<TKey>.HashFieldCount(key), static (q, s) => q.Execute(s));
355354
}
356355

357-
public override TimeSpan GetHashTtl([NotNull] string key)
356+
public override TimeSpan GetHashTtl(string key)
358357
{
359358
if (key == null) throw new ArgumentNullException(nameof(key));
360359

@@ -367,7 +366,7 @@ public override TimeSpan GetHashTtl([NotNull] string key)
367366
return expireIn >= TimeSpan.Zero ? expireIn : TimeSpan.Zero;
368367
}
369368

370-
public override TimeSpan GetListTtl([NotNull] string key)
369+
public override TimeSpan GetListTtl(string key)
371370
{
372371
if (key == null) throw new ArgumentNullException(nameof(key));
373372

@@ -380,7 +379,7 @@ public override TimeSpan GetListTtl([NotNull] string key)
380379
return expireIn >= TimeSpan.Zero ? expireIn : TimeSpan.Zero;
381380
}
382381

383-
public override TimeSpan GetSetTtl([NotNull] string key)
382+
public override TimeSpan GetSetTtl(string key)
384383
{
385384
if (key == null) throw new ArgumentNullException(nameof(key));
386385

@@ -393,37 +392,37 @@ public override TimeSpan GetSetTtl([NotNull] string key)
393392
return expireIn >= TimeSpan.Zero ? expireIn : TimeSpan.Zero;
394393
}
395394

396-
public override void SetRangeInHash([NotNull] string key, [NotNull] IEnumerable<KeyValuePair<string, string>> keyValuePairs)
395+
public override void SetRangeInHash(string key, IEnumerable<KeyValuePair<string, string>> keyValuePairs)
397396
{
398397
if (key == null) throw new ArgumentNullException(nameof(key));
399398
if (keyValuePairs == null) throw new ArgumentNullException(nameof(keyValuePairs));
400399

401400
Dispatcher.QueryWriteAndWait(new Commands<TKey>.HashSetRange(key, keyValuePairs));
402401
}
403402

404-
public override Dictionary<string, string>? GetAllEntriesFromHash([NotNull] string key)
403+
public override Dictionary<string, string>? GetAllEntriesFromHash(string key)
405404
{
406405
if (key == null) throw new ArgumentNullException(nameof(key));
407406

408407
return Dispatcher.QueryReadAndWait(new Queries<TKey>.HashGetAll(key), static (q, s) => q.Execute(s));
409408
}
410409

411-
public override string? GetValueFromHash([NotNull] string key, [NotNull] string name)
410+
public override string? GetValueFromHash(string key, string name)
412411
{
413412
if (key == null) throw new ArgumentNullException(nameof(key));
414413
if (name == null) throw new ArgumentNullException(nameof(name));
415414

416415
return Dispatcher.QueryReadAndWait(new Queries<TKey>.HashGet(key, name), static (q, s) => q.Execute(s));
417416
}
418417

419-
public override List<string> GetAllItemsFromList([NotNull] string key)
418+
public override List<string> GetAllItemsFromList(string key)
420419
{
421420
if (key == null) throw new ArgumentNullException(nameof(key));
422421

423422
return Dispatcher.QueryReadAndWait(new Queries<TKey>.ListGetAll(key), static (q, s) => q.Execute(s));
424423
}
425424

426-
public override List<string> GetRangeFromList([NotNull] string key, int startingFrom, int endingAt)
425+
public override List<string> GetRangeFromList(string key, int startingFrom, int endingAt)
427426
{
428427
if (key == null) throw new ArgumentNullException(nameof(key));
429428
if (startingFrom < 0) throw new ArgumentException("The value must be greater than or equal to zero.", nameof(startingFrom));
@@ -432,7 +431,7 @@ public override List<string> GetRangeFromList([NotNull] string key, int starting
432431
return Dispatcher.QueryReadAndWait(new Queries<TKey>.ListRange(key, startingFrom, endingAt), static (q, s) => q.Execute(s));
433432
}
434433

435-
public override List<string> GetRangeFromSet([NotNull] string key, int startingFrom, int endingAt)
434+
public override List<string> GetRangeFromSet(string key, int startingFrom, int endingAt)
436435
{
437436
if (key == null) throw new ArgumentNullException(nameof(key));
438437
if (startingFrom < 0) throw new ArgumentException("The value must be greater than or equal to zero.", nameof(startingFrom));

src/Hangfire.InMemory/InMemoryFetchedJob.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
// License along with Hangfire. If not, see <http://www.gnu.org/licenses/>.
1515

1616
using System;
17-
using Hangfire.Annotations;
1817
using Hangfire.InMemory.State;
1918
using Hangfire.Storage;
2019

@@ -26,9 +25,9 @@ internal sealed class InMemoryFetchedJob<TKey> : IFetchedJob
2625
private readonly InMemoryConnection<TKey> _connection;
2726

2827
public InMemoryFetchedJob(
29-
[NotNull] InMemoryConnection<TKey> connection,
30-
[NotNull] string queueName,
31-
[NotNull] string jobId)
28+
InMemoryConnection<TKey> connection,
29+
string queueName,
30+
string jobId)
3231
{
3332
_connection = connection ?? throw new ArgumentNullException(nameof(connection));
3433

src/Hangfire.InMemory/InMemoryMonitoringApi.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
using System.Diagnostics.CodeAnalysis;
1919
using System.Globalization;
2020
using System.Linq;
21-
using Hangfire.Annotations;
2221
using Hangfire.Common;
2322
using Hangfire.InMemory.State;
2423
using Hangfire.States;
@@ -54,7 +53,7 @@ internal sealed class InMemoryMonitoringApi<TKey> : JobStorageMonitor
5453
private readonly DispatcherBase<TKey> _dispatcher;
5554
private readonly IKeyProvider<TKey> _keyProvider;
5655

57-
public InMemoryMonitoringApi([NotNull] DispatcherBase<TKey> dispatcher, [NotNull] IKeyProvider<TKey> keyProvider)
56+
public InMemoryMonitoringApi(DispatcherBase<TKey> dispatcher, IKeyProvider<TKey> keyProvider)
5857
{
5958
_dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
6059
_keyProvider = keyProvider ?? throw new ArgumentNullException(nameof(keyProvider));
@@ -107,7 +106,7 @@ public override IList<ServerDto> Servers()
107106
}).ToList();
108107
}
109108

110-
public override JobDetailsDto? JobDetails([NotNull] string jobId)
109+
public override JobDetailsDto? JobDetails(string jobId)
111110
{
112111
if (jobId == null) throw new ArgumentNullException(nameof(jobId));
113112

@@ -165,7 +164,7 @@ public override StatisticsDto GetStatistics()
165164
};
166165
}
167166

168-
public override JobList<EnqueuedJobDto> EnqueuedJobs([NotNull] string queue, int from, int perPage)
167+
public override JobList<EnqueuedJobDto> EnqueuedJobs(string queue, int from, int perPage)
169168
{
170169
if (queue == null) throw new ArgumentNullException(nameof(queue));
171170

@@ -190,7 +189,7 @@ public override JobList<EnqueuedJobDto> EnqueuedJobs([NotNull] string queue, int
190189
})));
191190
}
192191

193-
public override JobList<FetchedJobDto> FetchedJobs([NotNull] string queue, int from, int perPage)
192+
public override JobList<FetchedJobDto> FetchedJobs(string queue, int from, int perPage)
194193
{
195194
if (queue == null) throw new ArgumentNullException(nameof(queue));
196195
return new JobList<FetchedJobDto>([]);
@@ -380,13 +379,13 @@ public override long ScheduledCount()
380379
return GetCountByStateName(ScheduledState.StateName);
381380
}
382381

383-
public override long EnqueuedCount([NotNull] string queue)
382+
public override long EnqueuedCount(string queue)
384383
{
385384
if (queue == null) throw new ArgumentNullException(nameof(queue));
386385
return _dispatcher.QueryReadAndWait(new MonitoringQueries<TKey>.QueueGetCount(queue), static (q, s) => q.Execute(s));
387386
}
388387

389-
public override long FetchedCount([NotNull] string queue)
388+
public override long FetchedCount(string queue)
390389
{
391390
if (queue == null) throw new ArgumentNullException(nameof(queue));
392391
return 0;

src/Hangfire.InMemory/InMemoryStorage.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// License along with Hangfire. If not, see <http://www.gnu.org/licenses/>.
1515

1616
using System;
17+
using System.Diagnostics.CodeAnalysis;
1718
#if !HANGFIRE_170
1819
using System.Collections.Generic;
1920
#endif
@@ -29,6 +30,7 @@ namespace Hangfire.InMemory
2930
/// A class that represents an in-memory job storage that stores all data
3031
/// related to background processing in a process' memory.
3132
/// </summary>
33+
[SuppressMessage("ReSharper", "RedundantNullnessAttributeWithNullableReferenceTypes", Justification = "Should be used for public classes")]
3234
public sealed class InMemoryStorage : JobStorage, IKeyProvider<Guid>, IKeyProvider<ulong>, IDisposable
3335
{
3436
private readonly Dispatcher<Guid>? _guidDispatcher;

0 commit comments

Comments
 (0)