The java.util.Objects class added in JDK 7 includes a pair of requireNonNull methods, one which takes one argument to be checked and another which takes a message for the NPE if one is thrown.
The JDK code would benefit from using these methods in lieu of the more verbose "if (o == null) throw new NullPointerException..."
The JDK code would benefit from using these methods in lieu of the more verbose "if (o == null) throw new NullPointerException..."
- relates to
-
JDK-8073479 Replace obj.getClass hacks with Objects.requireNonNull
-
- Resolved
-
-
JDK-8025100 Use j.u.Object.requireNonNull in j.l.invoke codebase
-
- Closed
-
-
JDK-8073550 java* tools: replace obj.getClass hacks with Assert.checkNonNull or Objects.requireNonNull
-
- Closed
-