https://docs.oracle.com/javase/8/docs/api/java/util/Optional...
The Kotlin language (JVM-based) got this right: https://kotlinlang.org/docs/reference/null-safety.html
In the meantime, Java coding best practices dictate treating all references as non-null in first-party code (defensively checking references received from third-party code, such as with Objects.requireNonNull), and avoiding nullable references in favor of Optional.
The issue of Optional<T> being nullable is an extremely uncommon one - I have seen it happen once ever, and there were way bigger issues going on that happened to manifest that way. It's one of those "that's dumb but ultimately makes no difference" problems that many languages have.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p032...
Returns a value (as in std::optional) than can be null. If so you will get an error explaining what happened.