Infer: eradicate and try-catch
- 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
Assessment
This issue has not been assessed yet.