False negatives with Java 11 (but as-expected behaviour with Java 8)
Example source code can be found here . The package issue1 contains 4 simple classes Foo1A, Foo1B, Foo2A, Foo2B all containing a NP issue triggered by null flowing from a producer to a consumer with some minor variations. This can be verified by running the respective main methods in those classes.
public class Foo1A {
public static void main (String[] args) {
String value = provide();
consume(value);
}
public static String provide() {
return null;
}
public static void consume(String value) {
String value2 = value.toLowerCase();
System.out.println(value2);
}
}
public class Foo1B {
public static void main (String[] args) {
consume();
}
public static String provide() {
return null;
}
public static void consume() {
String value = provide();
String value2 = value.toLowerCase();
System.out.println(value2);
}
}
(the other two classes are similar, see full example )
When running infer v1.1.0 with the following command:
infer run -- mvn clean compile
using Java 8
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
all 4 issues are detected as expected.
However, when running infer with Java 11:
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
, then only the null dereference in Foo1B is correctly detected (src/main/java/issue1/Foo1B.java:15:). Using the parameter --java-version 11 does not fix this.
waiting for solve, please
This is likely due to changes in debug format with javac -g. Infer parses that output and changes in it lead to missed files.
In particular, this regular expression may need to be updated.