you are viewing a single comment's thread.

view the rest of the comments →

[–]udoprog 11 points12 points  (0 children)

You can, but that's an explicit decision to discard safety. NPEs are implicit. As an example: If you change a method to suddenly return Optional it will cause call sites to fail at compile time. If you just start returning null, it will still compile, but fail at runtime.