-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fix issues with new nullability annotations #318
Comments
… be null even if we don't expect them to be
- ConfigMe doesn't provide null values for properties by default, but is somewhat "agnostic" at allowing other property implementations doing so. This is difficult to represent with the annotations, so some have been replaced by a comment "PV" (for property value) that should always be not null by default, but we cannot technically guarantee it.
It's a core concept of ConfigMe to not return null as property values since we'll fall back on the default value if we don't have any other knowledge. Nevertheless, I'm a little hesitant to flat out deny the possibility of having null as values if someone wants to use ConfigMe in such a way—as such, I've removed some |
Need to sleep on this. In the spirit of keeping it simple, maybe we should go all in and disallow null values. I think it's one of the core strengths of ConfigMe: being able to get values without needing to worry about nullness. Otherwise, |
- Undo most of 4c35833: consider property values to always be not-null as to benefit from type safety. Correct usage of ConfigMe should never return null as property value; instead, a suitable wrapper like Optional should be used.
Changed to consider property values not null. I think it works out best like this. Only odd remnant is this method in boolean isValidValue(@Nullable T value); ^ The base impl. makes sure that the value is not null. If I wrote this code today, I would do the null check (if at all) outside, e.g. in the SettingsManager itself. Might be changed in ConfigMe 2.0 to do that. For now I leave it because BaseProperty extensions might call #isValidValue internally (I know I've done so at least once in other projects) |
This issue handles short-term issues that block a release; long-term issues will be handled in #319.
Issues:
toExportValue
but it is not allowed in ListPropertyProperty<Optional<T>>
is promoted for any cases where we want to skip having values.The text was updated successfully, but these errors were encountered: