Skip to content
Advertisement

Tag: non-nullable

How to deal with warning ‘unsafe null type convertion’ when using java.lang.Optional

I would like to offer some accessors to a value-container (that is a java.lang.Map under the hood). When implementing accessors like this … ‘ofNullable’ is marked with ‘unsafe null type convertion’. Why is this? The parameter ofNullable is not marked as @NonNull. Is it, because empty() or of() is used and of() is checking for NonNull? Is this a Eclipse-bug,

Advertisement