3 ms·
Java aren't fixing nulls, IMHO. They are making it worse.
by richardwhiuk 6y ago
Java aren't fixing nulls, IMHO. They are making it worse.
- apta 6y agoHow are they making it worse? In any case, there already exist solutions in place: https://checkerframework.org/manual/#example-use https://checkerframework.org/manual/#example-use https://github.com/uber/NullAway https://github.com/uber/NullAway
- richardwhiuk 6y agoThe code ends up looking like: Optional<Integer> foo; //.... if (foo != null) { foo.and_then(new Consumer () { function accept(Integer foo) { } }); }
- karmakaze 6y agoI would never assign null to an Optional nor use a library that returned one. To ensure assignment before use make it final.