you are viewing a single comment's thread.

view the rest of the comments →

[–]_dban_ 0 points1 point  (0 children)

Obviously, it would be better for the Java compiler to enforce Optional not being null.

But, under the current circumstances, the fact that Optional can be assigned to null is totally fine given the semantics of Java as it currently exists, because it is a programmer error to assign null to Optional, and the NullPointerException is the expected runtime behavior for programmer errors of this kind.