diff --git a/osu.Framework.Tests/Bindables/BindableDoubleTest.cs b/osu.Framework.Tests/Bindables/BindableDoubleTest.cs index d076511803..8840a73402 100644 --- a/osu.Framework.Tests/Bindables/BindableDoubleTest.cs +++ b/osu.Framework.Tests/Bindables/BindableDoubleTest.cs @@ -125,7 +125,7 @@ public void TestParsingNumberLocale(double value, string locale, string expected CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo(locale); var bindable = new BindableDouble(value); - string? asString = bindable.ToString(); + string asString = bindable.ToString(); Assert.AreEqual(expected, asString); Assert.DoesNotThrow(() => bindable.Parse(asString, CultureInfo.CurrentCulture)); Assert.AreEqual(value, bindable.Value, Precision.DOUBLE_EPSILON); diff --git a/osu.Framework.Tests/Bindables/BindableFloatTest.cs b/osu.Framework.Tests/Bindables/BindableFloatTest.cs index 200988ee85..78792c2a97 100644 --- a/osu.Framework.Tests/Bindables/BindableFloatTest.cs +++ b/osu.Framework.Tests/Bindables/BindableFloatTest.cs @@ -112,7 +112,7 @@ public void TestParsingNumberLocale(float value, string locale, string expected) CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo(locale); var bindable = new BindableFloat(value); - string? asString = bindable.ToString(); + string asString = bindable.ToString(); Assert.AreEqual(expected, asString); Assert.DoesNotThrow(() => bindable.Parse(asString, CultureInfo.CurrentCulture)); Assert.AreEqual(value, bindable.Value, Precision.FLOAT_EPSILON); diff --git a/osu.Framework.Tests/Bindables/BindableLeasingTest.cs b/osu.Framework.Tests/Bindables/BindableLeasingTest.cs index fc2323e67b..4bb5419625 100644 --- a/osu.Framework.Tests/Bindables/BindableLeasingTest.cs +++ b/osu.Framework.Tests/Bindables/BindableLeasingTest.cs @@ -95,7 +95,7 @@ public void TestDoubleLeaseFails() public void TestIncorrectEndLease() { // end a lease when no lease exists. - Assert.Throws(() => original.EndLease(null)); + Assert.Throws(() => original.EndLease(null!)); // end a lease with an incorrect bindable original.BeginLease(true); diff --git a/osu.Framework.Tests/Visual/Platform/FrameworkConfigVisualiser.cs b/osu.Framework.Tests/Visual/Platform/FrameworkConfigVisualiser.cs index 56701f67e5..3f263cd991 100644 --- a/osu.Framework.Tests/Visual/Platform/FrameworkConfigVisualiser.cs +++ b/osu.Framework.Tests/Visual/Platform/FrameworkConfigVisualiser.cs @@ -59,6 +59,6 @@ protected override void LoadComplete() })); } - private void updateText() => valueText.Text = bindable.ToString() ?? ""; + private void updateText() => valueText.Text = bindable?.ToString() ?? ""; } } diff --git a/osu.Framework/Bindables/AggregateBindable.cs b/osu.Framework/Bindables/AggregateBindable.cs index e65a66e95b..41442f3504 100644 --- a/osu.Framework/Bindables/AggregateBindable.cs +++ b/osu.Framework/Bindables/AggregateBindable.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Collections.Generic; @@ -30,7 +28,7 @@ public class AggregateBindable /// /// The function to be used for aggregation, taking two input values and returning one output. /// An optional newly constructed bindable to use for . The initial value of this bindable is used as the initial value for the aggregate. - public AggregateBindable(Func aggregateFunction, Bindable resultBindable = null) + public AggregateBindable(Func aggregateFunction, Bindable? resultBindable = null) { this.aggregateFunction = aggregateFunction; result = resultBindable ?? new Bindable(); @@ -85,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 4447e2a153..fd2918d29c 100644 --- a/osu.Framework/Bindables/Bindable.cs +++ b/osu.Framework/Bindables/Bindable.cs @@ -1,10 +1,9 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; using JetBrains.Annotations; @@ -25,20 +24,17 @@ public class Bindable : IBindable, IBindable, IParseable, ISerializableBin /// /// An event which is raised when has changed (or manually via ). /// - [CanBeNull] - public event Action> ValueChanged; + public event Action>? ValueChanged; /// /// An event which is raised when has changed (or manually via ). /// - [CanBeNull] - public event Action DisabledChanged; + public event Action? DisabledChanged; /// /// An event which is raised when has changed (or manually via ). /// - [CanBeNull] - public event Action> DefaultChanged; + public event Action>? DefaultChanged; private T value; @@ -63,7 +59,7 @@ public virtual bool Disabled } } - internal void SetDisabled(bool value, bool bypassChecks = false, Bindable source = null) + internal void SetDisabled(bool value, bool bypassChecks = false, Bindable? source = null) { if (!bypassChecks) throwIfLeased(); @@ -94,7 +90,7 @@ public virtual T Value // if the leased bindable decides to disable exclusive access (by setting Disabled = false) then anything will be able to write to Value. if (Disabled) - throw new InvalidOperationException($"Can not set value to \"{value.ToString()}\" as bindable is disabled."); + throw new InvalidOperationException($"Can not set value to \"{value}\" as bindable is disabled."); if (EqualityComparer.Default.Equals(this.value, value)) return; @@ -102,7 +98,7 @@ public virtual T Value } } - internal void SetValue(T previousValue, T value, bool bypassChecks = false, Bindable source = null) + internal void SetValue(T previousValue, T value, bool bypassChecks = false, Bindable? source = null) { this.value = value; TriggerValueChange(previousValue, source ?? this, true, bypassChecks); @@ -120,7 +116,7 @@ public virtual T Default // if the leased bindable decides to disable exclusive access (by setting Disabled = false) then anything will be able to write to Default. if (Disabled) - throw new InvalidOperationException($"Can not set default value to \"{value.ToString()}\" as bindable is disabled."); + throw new InvalidOperationException($"Can not set default value to \"{value}\" as bindable is disabled."); if (EqualityComparer.Default.Equals(defaultValue, value)) return; @@ -128,13 +124,13 @@ public virtual T Default } } - internal void SetDefaultValue(T previousValue, T value, bool bypassChecks = false, Bindable source = null) + internal void SetDefaultValue(T previousValue, T value, bool bypassChecks = false, Bindable? source = null) { defaultValue = value; TriggerDefaultChange(previousValue, source ?? this, true, bypassChecks); } - private WeakReference> weakReferenceInstance; + private WeakReference>? weakReferenceInstance; private WeakReference> weakReference => weakReferenceInstance ??= new WeakReference>(this); @@ -143,7 +139,7 @@ internal void SetDefaultValue(T previousValue, T value, bool bypassChecks = fals /// [UsedImplicitly] private Bindable() - : this(default) + : this(default!) { } @@ -151,12 +147,14 @@ private Bindable() /// Creates a new bindable instance initialised with a default value. /// /// The initial and default value for this bindable. - public Bindable(T defaultValue = default) + public Bindable(T defaultValue = default!) { - value = Default = defaultValue; + // TODO: add a custom analyser warning about no default value provided for non-nullable T + // remember to also check for derived class constructors + value = this.defaultValue = defaultValue; } - protected LockedWeakList> Bindings { get; private set; } + protected LockedWeakList>? Bindings { get; private set; } void IBindable.BindTo(IBindable them) { @@ -249,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) { @@ -263,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; } @@ -283,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; } @@ -417,11 +415,11 @@ public virtual void UnbindFrom(IUnbindable them) tThem.removeWeakReference(weakReference); } - public string Description { get; set; } + public string Description { get; set; } = string.Empty; public sealed override string ToString() => ToString(null, CultureInfo.CurrentCulture); - public virtual string ToString(string format, IFormatProvider formatProvider) => string.Format(formatProvider, $"{{0:{format}}}", Value); + public virtual string ToString(string? format, IFormatProvider? formatProvider) => string.Format(formatProvider, $"{{0:{format}}}", Value); /// /// Create an unbound clone of this bindable. @@ -454,11 +452,14 @@ void ISerializableBindable.SerializeTo(JsonWriter writer, JsonSerializer seriali void ISerializableBindable.DeserializeFrom(JsonReader reader, JsonSerializer serializer) { - Value = serializer.Deserialize(reader); + // Deserialize returns null for json literal "null". + // The nullability of type parameter T is unavailable here, so we can't do any validation. + Value = serializer.Deserialize(reader).AsNonNull(); } - private LeasedBindable leasedBindable; + private LeasedBindable? leasedBindable; + [MemberNotNullWhen(true, nameof(leasedBindable))] private bool isLeased => leasedBindable != null; /// diff --git a/osu.Framework/Bindables/BindableDictionary.cs b/osu.Framework/Bindables/BindableDictionary.cs index 324c9c0f5e..22ba7cf87a 100644 --- a/osu.Framework/Bindables/BindableDictionary.cs +++ b/osu.Framework/Bindables/BindableDictionary.cs @@ -417,7 +417,7 @@ private void unbind(BindableDictionary binding) #region IHasDescription - public string? Description { get; set; } + public string Description { get; set; } = string.Empty; #endregion IHasDescription diff --git a/osu.Framework/Bindables/BindableList.cs b/osu.Framework/Bindables/BindableList.cs index 2877cf2527..33e0c4d016 100644 --- a/osu.Framework/Bindables/BindableList.cs +++ b/osu.Framework/Bindables/BindableList.cs @@ -1,17 +1,15 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Globalization; using System.Linq; -using JetBrains.Annotations; using osu.Framework.Caching; using osu.Framework.Extensions.TypeExtensions; +using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Lists; namespace osu.Framework.Bindables @@ -21,13 +19,12 @@ public class BindableList : IBindableList, IBindable, IParseable, IList /// /// An event which is raised when this changes. /// - public event NotifyCollectionChangedEventHandler CollectionChanged; + public event NotifyCollectionChangedEventHandler? CollectionChanged; /// /// An event which is raised when 's state has changed (or manually via ). /// - [CanBeNull] - public event Action DisabledChanged; + public event Action? DisabledChanged; private readonly List collection = new List(); @@ -35,13 +32,13 @@ public class BindableList : IBindableList, IBindable, IParseable, IList private WeakReference> weakReference => weakReferenceCache.IsValid ? weakReferenceCache.Value : weakReferenceCache.Value = new WeakReference>(this); - private LockedWeakList> bindings; + private LockedWeakList>? bindings; /// /// Creates a new , optionally adding the items of the given collection. /// /// The items that are going to be contained in the newly created . - public BindableList(IEnumerable items = null) + public BindableList(IEnumerable? items = null) { if (items != null) collection.AddRange(items); @@ -388,25 +385,25 @@ public void CopyTo(Array array, int index) #region IList - object IList.this[int index] + object? IList.this[int index] { get => this[index]; - set => this[index] = (T)value; + set => this[index] = (T)value.AsNonNull(); } - int IList.Add(object value) + int IList.Add(object? value) { - Add((T)value); + Add((T)value.AsNonNull()); return Count - 1; } - bool IList.Contains(object value) => Contains((T)value); + bool IList.Contains(object? value) => Contains((T)value.AsNonNull()); - int IList.IndexOf(object value) => IndexOf((T)value); + int IList.IndexOf(object? value) => IndexOf((T)value.AsNonNull()); - void IList.Insert(int index, object value) => Insert(index, (T)value); + void IList.Insert(int index, object? value) => Insert(index, (T)value.AsNonNull()); - void IList.Remove(object value) => Remove((T)value); + void IList.Remove(object? value) => Remove((T)value.AsNonNull()); bool IList.IsFixedSize => false; @@ -421,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(); @@ -530,7 +527,7 @@ public virtual void UnbindFrom(IUnbindable them) #region IHasDescription - public string Description { get; set; } + public string Description { get; set; } = string.Empty; #endregion IHasDescription @@ -690,6 +687,6 @@ private void ensureMutationAllowed() public bool IsDefault => Count == 0; - string IFormattable.ToString(string format, IFormatProvider formatProvider) => ((FormattableString)$"{GetType().ReadableName()}({nameof(Count)}={Count})").ToString(formatProvider); + string IFormattable.ToString(string? format, IFormatProvider? formatProvider) => ((FormattableString)$"{GetType().ReadableName()}({nameof(Count)}={Count})").ToString(formatProvider); } } diff --git a/osu.Framework/Bindables/BindableNumber.cs b/osu.Framework/Bindables/BindableNumber.cs index c7099dcac7..28664b4f08 100644 --- a/osu.Framework/Bindables/BindableNumber.cs +++ b/osu.Framework/Bindables/BindableNumber.cs @@ -1,11 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Numerics; -using JetBrains.Annotations; using osu.Framework.Utils; namespace osu.Framework.Bindables @@ -13,8 +10,7 @@ namespace osu.Framework.Bindables public class BindableNumber : RangeConstrainedBindable, IBindableNumber where T : struct, INumber, IMinMaxValue { - [CanBeNull] - public event Action PrecisionChanged; + public event Action? PrecisionChanged; public BindableNumber(T defaultValue = default) : base(defaultValue) @@ -114,7 +110,7 @@ public override void TriggerChange() TriggerPrecisionChange(this, false); } - protected void TriggerPrecisionChange(BindableNumber source = null, bool propagateToBindings = true) + protected void TriggerPrecisionChange(BindableNumber? source = null, bool propagateToBindings = true) { // check a bound bindable hasn't changed the value again (it will fire its own event) T beforePropagation = precision; diff --git a/osu.Framework/Bindables/BindableNumberWithCurrent.cs b/osu.Framework/Bindables/BindableNumberWithCurrent.cs index 6064d65691..38329f5c70 100644 --- a/osu.Framework/Bindables/BindableNumberWithCurrent.cs +++ b/osu.Framework/Bindables/BindableNumberWithCurrent.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Numerics; @@ -15,7 +13,7 @@ namespace osu.Framework.Bindables public class BindableNumberWithCurrent : BindableNumber, IBindableWithCurrent where T : struct, INumber, IMinMaxValue { - private BindableNumber currentBound; + private BindableNumber? currentBound; public Bindable Current { diff --git a/osu.Framework/Bindables/BindableWithCurrent.cs b/osu.Framework/Bindables/BindableWithCurrent.cs index cb8ac255e9..6d7f2e1fa5 100644 --- a/osu.Framework/Bindables/BindableWithCurrent.cs +++ b/osu.Framework/Bindables/BindableWithCurrent.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; namespace osu.Framework.Bindables @@ -13,7 +11,7 @@ namespace osu.Framework.Bindables /// The type of our stored . public class BindableWithCurrent : Bindable, IBindableWithCurrent { - private Bindable currentBound; + private Bindable? currentBound; public Bindable Current { @@ -27,7 +25,7 @@ public Bindable Current } } - public BindableWithCurrent(T defaultValue = default) + public BindableWithCurrent(T defaultValue = default!) : base(defaultValue) { } diff --git a/osu.Framework/Bindables/IBindable.cs b/osu.Framework/Bindables/IBindable.cs index dc64d96f00..6d3aabed9a 100644 --- a/osu.Framework/Bindables/IBindable.cs +++ b/osu.Framework/Bindables/IBindable.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using osu.Framework.Extensions.TypeExtensions; using osu.Framework.Utils; diff --git a/osu.Framework/Bindables/IBindableWithCurrent.cs b/osu.Framework/Bindables/IBindableWithCurrent.cs index 5c5987f7ea..e8af747113 100644 --- a/osu.Framework/Bindables/IBindableWithCurrent.cs +++ b/osu.Framework/Bindables/IBindableWithCurrent.cs @@ -1,9 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; +using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics.UserInterface; using osu.Framework.Utils; @@ -19,7 +18,7 @@ public interface IBindableWithCurrent : IBindable, IHasCurrentValue public static IBindableWithCurrent Create() { if (Validation.IsSupportedBindableNumberType()) - return (IBindableWithCurrent)Activator.CreateInstance(typeof(BindableNumberWithCurrent<>).MakeGenericType(typeof(T)), default(T)); + return (IBindableWithCurrent)Activator.CreateInstance(typeof(BindableNumberWithCurrent<>).MakeGenericType(typeof(T)), default(T)).AsNonNull(); return new BindableWithCurrent(); } diff --git a/osu.Framework/Bindables/IHasDescription.cs b/osu.Framework/Bindables/IHasDescription.cs index 4865b7f7f6..a5660e15b9 100644 --- a/osu.Framework/Bindables/IHasDescription.cs +++ b/osu.Framework/Bindables/IHasDescription.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - namespace osu.Framework.Bindables { /// diff --git a/osu.Framework/Bindables/LeasedBindable.cs b/osu.Framework/Bindables/LeasedBindable.cs index d3b9654960..32d7f0d051 100644 --- a/osu.Framework/Bindables/LeasedBindable.cs +++ b/osu.Framework/Bindables/LeasedBindable.cs @@ -1,11 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Collections.Generic; -using JetBrains.Annotations; namespace osu.Framework.Bindables { @@ -16,13 +13,13 @@ namespace osu.Framework.Bindables /// public class LeasedBindable : Bindable, ILeasedBindable { - private readonly Bindable source; + private readonly Bindable? source; - private readonly T valueBeforeLease; + private readonly T valueBeforeLease = default!; private readonly bool disabledBeforeLease; private readonly bool revertValueOnReturn; - internal LeasedBindable([NotNull] Bindable source, bool revertValueOnReturn) + internal LeasedBindable(Bindable source, bool revertValueOnReturn) { BindTo(source); @@ -39,7 +36,7 @@ internal LeasedBindable([NotNull] Bindable source, bool revertValueOnReturn) Disabled = true; } - private LeasedBindable(T defaultValue = default) + private LeasedBindable(T defaultValue = default!) : base(defaultValue) { // used for GetBoundCopy, where we don't want a source. diff --git a/osu.Framework/Bindables/RangeConstrainedBindable.cs b/osu.Framework/Bindables/RangeConstrainedBindable.cs index 8721ecc413..f5d89a4e28 100644 --- a/osu.Framework/Bindables/RangeConstrainedBindable.cs +++ b/osu.Framework/Bindables/RangeConstrainedBindable.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Collections.Generic; @@ -10,9 +8,9 @@ namespace osu.Framework.Bindables { public abstract class RangeConstrainedBindable : Bindable { - public event Action MinValueChanged; + public event Action? MinValueChanged; - public event Action MaxValueChanged; + public event Action? MaxValueChanged; private T minValue; @@ -64,7 +62,7 @@ public override T Value public bool HasDefinedRange => !EqualityComparer.Default.Equals(MinValue, DefaultMinValue) || !EqualityComparer.Default.Equals(MaxValue, DefaultMaxValue); - protected RangeConstrainedBindable(T defaultValue = default) + protected RangeConstrainedBindable(T defaultValue = default!) : base(defaultValue) { minValue = DefaultMinValue; @@ -92,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(); } @@ -159,7 +157,7 @@ public override void TriggerChange() TriggerMaxValueChange(this, false); } - protected void TriggerMinValueChange(RangeConstrainedBindable source = null, bool propagateToBindings = true) + protected void TriggerMinValueChange(RangeConstrainedBindable? source = null, bool propagateToBindings = true) { // check a bound bindable hasn't changed the value again (it will fire its own event) T beforePropagation = minValue; @@ -179,7 +177,7 @@ protected void TriggerMinValueChange(RangeConstrainedBindable source = null, MinValueChanged?.Invoke(minValue); } - protected void TriggerMaxValueChange(RangeConstrainedBindable source = null, bool propagateToBindings = true) + protected void TriggerMaxValueChange(RangeConstrainedBindable? source = null, bool propagateToBindings = true) { // check a bound bindable hasn't changed the value again (it will fire its own event) T beforePropagation = maxValue; diff --git a/osu.Framework/Graphics/Audio/DrawableSample.cs b/osu.Framework/Graphics/Audio/DrawableSample.cs index 20c96fb0e0..23d69461d6 100644 --- a/osu.Framework/Graphics/Audio/DrawableSample.cs +++ b/osu.Framework/Graphics/Audio/DrawableSample.cs @@ -57,7 +57,7 @@ public SampleChannel GetChannel() private IAudioMixer? mixer; - protected override void OnMixerChanged(ValueChangedEvent mixer) + protected override void OnMixerChanged(ValueChangedEvent mixer) { base.OnMixerChanged(mixer); diff --git a/osu.Framework/Localisation/LocalisationManager_LocalisedBindableString.cs b/osu.Framework/Localisation/LocalisationManager_LocalisedBindableString.cs index 88f7bcd1a0..f4bb5a387e 100644 --- a/osu.Framework/Localisation/LocalisationManager_LocalisedBindableString.cs +++ b/osu.Framework/Localisation/LocalisationManager_LocalisedBindableString.cs @@ -1,10 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - -#pragma warning disable 8632 // TODO: can be #nullable enable when Bindables are updated to also be. - using osu.Framework.Bindables; namespace osu.Framework.Localisation @@ -13,7 +9,7 @@ public partial class LocalisationManager { private class LocalisedBindableString : Bindable, ILocalisedBindableString { - private IBindable parameters; + private IBindable? parameters; private LocalisableString text;