You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With Checker Framework 3.43.0 the Nullness Checker reports an error:
Foo.java:14: error: [dereference.of.nullable] dereference of possibly-null reference t
t.hashCode();
^
1 error
This is a false positive, and no such error is reported with Checker Framework 3.42.0. Sorry, not set up to test the master branch on this machine, but I'll try that soon.
NullAway also reports a false positive after updating to the 3.43.0 version of dataflow, so I expect this is some new imprecision in the control-flow graph.
The text was updated successfully, but these errors were encountered:
This bisected to 921a66e, i.e., eisop#620. Upon further thought, this may be a true positive report. The code does not even compile if you rewrite it to not use an initializer expression:
classFoo {
enumType { TYPE1, TYPE2 }
staticvoidtest(Typetype) {
Stringt;
switch (type) {
caseTYPE1:
t = "hello";
break;
caseTYPE2:
t = "goodbye";
}
t.hashCode(); // compiler error here that t might not have been initialized
}
}
The version with a switch expression does compile:
But for the switch expression, the compiler generates a default case that throws an exception if the enum evolves so that there is a new unmatched case. So, for the original test, it seems reasonable to treat t.hashCode() as possibly being a null dereference.
I'm going to go ahead and close this for now, but I'll reopen if I see a new angle.
Test:
With Checker Framework 3.43.0 the Nullness Checker reports an error:
This is a false positive, and no such error is reported with Checker Framework 3.42.0. Sorry, not set up to test the master branch on this machine, but I'll try that soon.
NullAway also reports a false positive after updating to the 3.43.0 version of dataflow, so I expect this is some new imprecision in the control-flow graph.
The text was updated successfully, but these errors were encountered: