False-positive when dereferencing an inline-initialized field from constructor body
@NullMarked
class Foo {
private @Nullable Object mArgs = new Object();
Foo() {
mArgs.getClass();
}
}
Gives:
Foo.java:9: warning: [NullAway] dereferenced expression mArgs is @Nullable
mArgs.getClass();
^
(see http://t.uber.com/nullaway )
I can reproduce this and I think we should handle it. It'll take a bit of time to do the implementation required.
@agrieve getting back to this one after a while. How important is fixing this for you all? I have a tentative fix but I'm a bit concerned about performance overhead. But if it comes up a lot for you I can probably optimize it and get it in
I haven't personally hit it since reporting it.
Ok, since this just leads to false positives and it seems to come up rarely, I'm going to de-prioritize it for now. Happy to look again if someone else hits this very regularly.