facebook / facebook/infer

Infer: eradicate and try-catch

Open
#226 4 comments 0 reactions 0 assignees View on GitHub
false-negative java wishlist
Dominant language
OCaml
Stars
15.7k
Forks
2.1k
Avg merge
19h 36m
Merged PRs (30d)
13

Description

It seems that infer: eradicate treats catch-blocks as never executed, at least in some cases. Below is an example class that "infer -a eradicate" claims has no issues. If the assignment "path = null" is moved after the catch-block (or into the try-block) then the assignment "filePath = path" is (correctly) flagged as an error. Is this a bug in infer or an issue with models?

``` java
public class ExceptionTest {
String filePath = "";
public OutputStream returnStream(){
File file = null;
OutputStream stream = null;
String path = null;
try{
file = File.createTempFile("tmp", "tmp");
stream = new FileOutputStream(file);
path = file.getAbsolutePath();
}catch(IOException e) {
path = null;
}
filePath = path;
return stream;
}
}
```

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.