Skip to content

Commit ee2596f

Browse files
authored
chore: Enable nullable annotations on BenchmarkDotNet project (#3003)
* chore: enable nullable annotation * chore: remove source-level nullable annotations * chore: remove unused nullable annotation blocks
1 parent 7563eb4 commit ee2596f

207 files changed

Lines changed: 273 additions & 558 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/BenchmarkDotNet/Attributes/ConfigAttribute.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
using System;
22
using BenchmarkDotNet.Configs;
33

4-
#nullable enable
5-
64
namespace BenchmarkDotNet.Attributes
75
{
86
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly)]

src/BenchmarkDotNet/Attributes/Jobs/SimpleJobAttribute.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
using BenchmarkDotNet.Jobs;
66
using JetBrains.Annotations;
77

8-
#nullable enable
9-
108
namespace BenchmarkDotNet.Attributes
119
{
1210
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)]

src/BenchmarkDotNet/BenchmarkDotNet.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<RootNamespace>BenchmarkDotNet</RootNamespace>
1111
<!-- needed for docfx xref resolver -->
1212
<ProduceReferenceAssembly>True</ProduceReferenceAssembly>
13+
<Nullable>enable</Nullable>
1314
</PropertyGroup>
1415
<ItemGroup>
1516
<EmbeddedResource Include="Templates\*" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />

src/BenchmarkDotNet/Characteristics/Characteristic.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
using System.Diagnostics.CodeAnalysis;
33
using static BenchmarkDotNet.Characteristics.CharacteristicHelper;
44

5-
#nullable enable
6-
75
namespace BenchmarkDotNet.Characteristics
86
{
97
public abstract class Characteristic
@@ -96,7 +94,7 @@ public object? this[CharacteristicObject obj]
9694

9795
public bool HasChildCharacteristics => IsCharacteristicObjectSubclass(CharacteristicType);
9896

99-
internal virtual object? ResolveValueCore(CharacteristicObject obj, object currentValue) =>
97+
internal virtual object? ResolveValueCore(CharacteristicObject obj, object? currentValue) =>
10098
ReferenceEquals(currentValue, EmptyValue) ? FallbackValue : currentValue;
10199

102100
public override string ToString() => Id;

src/BenchmarkDotNet/Characteristics/CharacteristicHelper.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
using System.Reflection;
77
using JetBrains.Annotations;
88

9-
#nullable enable
10-
119
namespace BenchmarkDotNet.Characteristics
1210
{
1311
public static class CharacteristicHelper

src/BenchmarkDotNet/Characteristics/CharacteristicObject.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
using BenchmarkDotNet.Extensions;
77
using JetBrains.Annotations;
88

9-
#nullable enable
10-
119
namespace BenchmarkDotNet.Characteristics
1210
{
1311
// TODO: better naming.

src/BenchmarkDotNet/Characteristics/CharacteristicPresenter.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
using BenchmarkDotNet.Helpers;
66
using BenchmarkDotNet.Jobs;
77

8-
#nullable enable
9-
108
namespace BenchmarkDotNet.Characteristics
119
{
1210
public abstract class CharacteristicPresenter

src/BenchmarkDotNet/Characteristics/CharacteristicSetPresenter.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
using System.Collections.Generic;
88
using System.Linq;
99

10-
#nullable enable
11-
1210
namespace BenchmarkDotNet.Characteristics
1311
{
1412
public abstract class CharacteristicSetPresenter

src/BenchmarkDotNet/Characteristics/Characteristic`1.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
using System;
22
using System.Diagnostics.CodeAnalysis;
33

4-
#nullable enable
5-
64
namespace BenchmarkDotNet.Characteristics
75
{
86
public class Characteristic<[DynamicallyAccessedMembers(CharacteristicObject.CharacteristicMemberTypes)] T> : Characteristic
@@ -30,7 +28,7 @@ internal Characteristic(
3028
set { obj.SetValue(this, value); }
3129
}
3230

33-
internal override object? ResolveValueCore(CharacteristicObject obj, object currentValue)
31+
internal override object? ResolveValueCore(CharacteristicObject obj, object? currentValue)
3432
{
3533
if (Resolver == null)
3634
return (T?)base.ResolveValueCore(obj, currentValue);

src/BenchmarkDotNet/Characteristics/CompositeResolver.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
using System.Diagnostics.CodeAnalysis;
33
using System.Linq;
44

5-
#nullable enable
6-
75
namespace BenchmarkDotNet.Characteristics
86
{
97
public class CompositeResolver : IResolver

0 commit comments

Comments
 (0)