FALSE NEGATIVE: PULSE_RESOURCE_LEAK misses unclosed PrintWriter constructors
- Dominant language
- OCaml
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 19h 36m
- Merged PRs (30d)
- 13
Description
**Affected tool**
`Infer 1.3.0`
**Affected checker**
`Infer PULSE_RESOURCE_LEAK`
**Minimal reproducer**
```java
import java.io.IOException;
import java.io.PrintWriter;
class InferPulsePrintWriterLeak {
void test() throws IOException {
PrintWriter writer = new PrintWriter("log.txt");
writer.println("record");
}
}
```
**Reproduction command**
```bash
infer --version
infer run --pulse --enable-issue-type PULSE_RESOURCE_LEAK -- javac infer-pulse-resourceleak-fn-printwriter.java
```
**Current behavior**
Infer 1.3.0 completes successfully with no `PULSE_RESOURCE_LEAK` finding. The result was reproduced twice with the minimal program. As controls, Infer reports a bare `FileWriter`, but reports neither `new PrintWriter("log.txt")` nor `new PrintWriter(new FileWriter("log.txt"))`.
**Expected behavior**
Infer should report the `PrintWriter` allocation at line 6. `PrintWriter(String)` opens and owns its file output resource, but it is neither closed nor returned on the normal path. The controls isolate the missing model to `PrintWriter`, rather than `FileWriter`.
Contributor guide
Assessment
This issue has not been assessed yet.