diff --git a/osu.Framework/Bindables/AggregateBindable.cs b/osu.Framework/Bindables/AggregateBindable.cs index b1782def65..41442f3504 100644 --- a/osu.Framework/Bindables/AggregateBindable.cs +++ b/osu.Framework/Bindables/AggregateBindable.cs @@ -83,7 +83,7 @@ public void RemoveSource(IBindable bindable) return null; } - private void recalculateAggregate(ValueChangedEvent obj = null) + private void recalculateAggregate(ValueChangedEvent? obj = null) { T calculated = initialValue; diff --git a/osu.Framework/Bindables/Bindable.cs b/osu.Framework/Bindables/Bindable.cs index 2802a074ac..fd2918d29c 100644 --- a/osu.Framework/Bindables/Bindable.cs +++ b/osu.Framework/Bindables/Bindable.cs @@ -247,7 +247,7 @@ private void addWeakReference(WeakReference> weakReference) /// /// The input which is to be parsed. /// An object that provides culture-specific formatting information about . - public virtual void Parse(object input, IFormatProvider provider) + public virtual void Parse(object? input, IFormatProvider provider) { switch (input) { @@ -261,7 +261,7 @@ public virtual void Parse(object input, IFormatProvider provider) // Nullable value types and reference types (annotated or not) are allowed to be initialised with `null`. if (typeof(T).IsNullable() || typeof(T).IsClass) { - Value = default; + Value = default!; break; } @@ -281,7 +281,7 @@ public virtual void Parse(object input, IFormatProvider provider) // Nullable value types and reference types are initialised to `null` on empty strings. if (typeof(T).IsNullable() || typeof(T).IsClass) { - Value = default; + Value = default!; break; } diff --git a/osu.Framework/Bindables/BindableList.cs b/osu.Framework/Bindables/BindableList.cs index 2975e701c8..33e0c4d016 100644 --- a/osu.Framework/Bindables/BindableList.cs +++ b/osu.Framework/Bindables/BindableList.cs @@ -418,7 +418,7 @@ int IList.Add(object? value) /// The input which is to be parsed. /// Not valid for . /// Thrown if this is . - public void Parse(object input, IFormatProvider provider) + public void Parse(object? input, IFormatProvider provider) { ensureMutationAllowed(); diff --git a/osu.Framework/Bindables/RangeConstrainedBindable.cs b/osu.Framework/Bindables/RangeConstrainedBindable.cs index f89e27ccc2..f5d89a4e28 100644 --- a/osu.Framework/Bindables/RangeConstrainedBindable.cs +++ b/osu.Framework/Bindables/RangeConstrainedBindable.cs @@ -90,25 +90,25 @@ public float NormalizedValue private static float convertToSingle(T val) { if (typeof(T) == typeof(sbyte)) - return Convert.ToSingle((sbyte)(object)val); + return Convert.ToSingle((sbyte)(object)val!); if (typeof(T) == typeof(byte)) - return Convert.ToSingle((byte)(object)val); + return Convert.ToSingle((byte)(object)val!); if (typeof(T) == typeof(short)) - return Convert.ToSingle((short)(object)val); + return Convert.ToSingle((short)(object)val!); if (typeof(T) == typeof(ushort)) - return Convert.ToSingle((ushort)(object)val); + return Convert.ToSingle((ushort)(object)val!); if (typeof(T) == typeof(int)) - return Convert.ToSingle((int)(object)val); + return Convert.ToSingle((int)(object)val!); if (typeof(T) == typeof(uint)) - return Convert.ToSingle((uint)(object)val); + return Convert.ToSingle((uint)(object)val!); if (typeof(T) == typeof(long)) - return Convert.ToSingle((long)(object)val); + return Convert.ToSingle((long)(object)val!); if (typeof(T) == typeof(ulong)) - return Convert.ToSingle((ulong)(object)val); + return Convert.ToSingle((ulong)(object)val!); if (typeof(T) == typeof(double)) - return Convert.ToSingle((double)(object)val); + return Convert.ToSingle((double)(object)val!); if (typeof(T) == typeof(float)) - return (float)(object)val; + return (float)(object)val!; throw new InvalidOperationException(); }