facebook / facebook/infer

FALSE NEGATIVE: NULLPTR_DEREFERENCE misses a static final null field

Open
#2,102 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
OCaml
Stars
15.7k
Forks
2.1k
Avg merge
19h 36m
Merged PRs (30d)
13

Description

Hi, I found a false negative in Infer 1.3.0 when a static final field initialized to null is dereferenced.

**Affected checker**

`Infer NULLPTR_DEREFERENCE`

**Minimal reproducer**

```java
class InferNullStaticField {
static final Object VALUE = null;

void test() {
VALUE.toString();
}
}
```

**Reproduction command**

```bash
infer --version
infer run --pulse --enable-issue-type NULLPTR_DEREFERENCE -- javac infer-nullptr-fn-static-null-field.java
```

**Current behavior**

Infer completes successfully but produces no `NULLPTR_DEREFERENCE` finding.

**Expected behavior**

Infer should report `NULLPTR_DEREFERENCE` at line 5 because `VALUE` is initialized to null and dereferenced.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.