I know that null being added to every type in Java is a source of much frustration regarding the language's type system. At the same time I generally hear complaining about checked exceptions - that they clutter interfaces, encourage exception swallowing, etc. It seems to me like null inhabiting every type is a way around the language - like I want the type of this to be
X, but it's actually
X or null; it just doesn't look like that and is easy to forget. Don't checked exceptions provide a way for the type of something to be
X or throws Exception instead of it appearing to just be
X? It provides an in-code way to specify how something can fail.
Nulls in every type and unchecked exceptions seem like they are dual concepts, but one is scorned and the other praised. Why is that?