[x] Which command you ran, for example infer -- make: infer run --fail-on-issue -- mvn compile
[ ] The full output in a paste, for instance a gist.
[x] If possible, a minimal example to reproduce your problem (for instance, some code where
infer reports incorrectly, together with the way you run infer to reproduce the incorrect
report).
Logs
error: Null Dereference
object `futureResult` last assigned on line 53 could be null and is dereferenced at line 83.
81. } finally {
82. if (Objects.nonNull(futureResult)) {
83. > futureResult.cancel(true);
84. }
85. executor.shutdown();
Example to reproduce
Future variable = null;
if (Objects.nonNull(variable)) {
variable.cancel(); // Infer thinks variable is null here
}
This seems to stem from Objects.nonNull(): Infer doesn't understand it, and only seem to understand x != null.
In java, Infer sometimes fails to see that null has been accounted for, depending on how nullity is checked for.
Information
infer --version
: 1.1.0infer -- make
:infer run --fail-on-issue -- mvn compile
Logs
Example to reproduce
This seems to stem from
Objects.nonNull()
: Infer doesn't understand it, and only seem to understandx != null
.