The codebase currently uses the following idiom
Object foo; if (Objects.isNull(foo)) { // ... }
While this works, it is a misuse of these two methods, which are documented as:
API Note: This method exists to be used as a Predicate, filter(Objects::isNull)
It also has two down sides:
- it hides the null check from static analysis tools like SpotBugs
- it generates more bytecode, as instead of a bytecode instruction (https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html#jvms-6.5.ifnull ) to represent the if branch we end up with an invocation and a subsequent check