-
-
Notifications
You must be signed in to change notification settings - Fork 1k
chore: Enable nullable for job/characteristics relating code #2900
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
base: master
Are you sure you want to change the base?
Conversation
| false); | ||
|
|
||
| public static Characteristic<T> Create<TOwner, [DynamicallyAccessedMembers(CharacteristicObject.CharacteristicMemberTypes)] T>(string memberName, Func<CharacteristicObject, T, T> resolver, T fallbackValue, bool ignoreOnApply) | ||
| public static Characteristic<T> Create<TOwner, [DynamicallyAccessedMembers(CharacteristicObject.CharacteristicMemberTypes)] T>(string memberName, Func<CharacteristicObject, T?, T> resolver, T fallbackValue, bool ignoreOnApply) |
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.
It need to allow null because some characteristics expected to return null(e.g. RuntimeCharacteristic/EnvironmentVariablesCharacteristic)
|
|
||
| if (result.Length == 0) | ||
| result = IdCharacteristic.FallbackValue; | ||
| result = IdCharacteristic.FallbackValue!; |
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.
IdCharacteristic specify Default as fallback value. so it must not be null.
| public InfrastructureMode Infrastructure => InfrastructureCharacteristic[this]; | ||
| public AccuracyMode Accuracy => AccuracyCharacteristic[this]; | ||
| public MetaMode Meta => MetaCharacteristic[this]; | ||
| public EnvironmentMode Environment => EnvironmentCharacteristic[this]!; |
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.
Following getter field are set by constructor and should not be null.
- Environment
- Run
- Accuracy
- Meta
f21f56d to
d7ebe52
Compare
This PR intended to fix a part issue of #2815
What's changed in this PR
Add
#nullable enablesetting and fix nullable annotations.And fix nullable errors.
Other changes
Remove
nullableannotation fromCharacteristicObjectconstructor'sidparameter.when
nullor""is passed to CharacteristicObject constructor.It skip setting
IdCharacteristic. andDefaultis used when getting Id as fallback value.