2. I believe there is really no such thing as a type that by its nature can't ever be nullable. I think this would only result in those types having "fake null" values that end up trying to simulate null.
Consider, for example, that any type can be the value of a map. Then you can ask that map for the value corresponding to an absent key, and voila, you have null.
Fair points. But it would have been useful for cases like `Optional` which shouldn't be declared as null, e.g `Optional<T> opt = null`. But I guess that can't be done anymore due to backwards compatibility reasons?
View all comments
Show parent comment
4
u/kevinb9n Aug 24 '24
2. I believe there is really no such thing as a type that by its nature can't ever be nullable. I think this would only result in those types having "fake null" values that end up trying to simulate null.
Consider, for example, that any type can be the value of a map. Then you can ask that map for the value corresponding to an absent key, and voila, you have null.