A very nice and powerful tool! I found an interesting case.
Infer version: 1.1.0
OS version: Ubuntu 20.04
Command:
infer run --pulse -- javac Test.java
Output:
Capturing in javac mode...
Found 1 source file to analyze in /path/to/infer-out
1/1 [################################################################################] 100% 63.113ms
Code example:
enum Color {
BLACK,
WHITE;
}
public class Test {
Color color = null;
public String bad() {
switch (color) {
case BLACK:
return "BLACK";
case WHITE:
return "WHITE";
default:
return "DEFAULT";
}
}
}
However, if we move color to bad(), we can get NULL_DEREFERENCE warning:
public String bad() {
Color color = null;
switch (color) {
case BLACK:
return "BLACK";
case WHITE:
return "WHITE";
default:
return "DEFAULT";
}
}
A very nice and powerful tool! I found an interesting case.
Infer version: 1.1.0 OS version: Ubuntu 20.04 Command:
Output:
Code example:
However, if we move color to
bad()
, we can get NULL_DEREFERENCE warning: