Re:Engineering NullAway, Uber’s Open Source Tool for Detecti...
by dbdr on Monday October 23, 2017 @03:02AM
(#15531258)
A code example contains:
if (x.f != null) {
System.out.println(x.f.toString());
}
Apparently NullAway infers that x.f cannot be null inside the branch, so calling x.f.toString() is safe. However, strictly speaking, since field f is not final, it is possible that a different thread would modify it between the test and the call, resulting in a NullPointerException. Have you decided to just ignore such effects of multi-threading?
Re:Engineering NullAway, Uber’s Open Source Tool for Detecti...
by rakingleaves on Thursday November 02, 2017 @08:05PM
(#15615547)
Hi, good point! Yes, we are deliberately ignoring multithreading, among many other things. We were aiming to catch the NPEs we see most often in practice while keeping the type system relatively simple. Based on our data from the field, I think NPEs due to multithreading and code like the example are fairly rare.