You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code passes the checks, but I get NPE at runtime
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "String.replace(java.lang.CharSequence, java.lang.CharSequence)" because "<local3>" is null
at Test.main(Test.java:11)
Expected behavior
The code should have been rejected.
The text was updated successfully, but these errors were encountered:
Thanks for the report! I can reproduce the problem.
public class Test {
public static <T> T m(T x) { return x; }
public static void main(String[] args) {
String p2 = null;
var x = m(p2);
String y = x;
y.replace("", "");
}
}
produces no warning. Changing the type of x from var to the supposedly equal String gives the expected warning.
As you didn't file this issue with typetools, I assume that it was fixed in a release we haven't pulled into eisop yet.
We'll verify this before working on a fix.
Yes, you are right! It seems it has been fixed in typetools, because typetools 3.42.0 fails to identify the error, but typetoools 3.47.0 detects it! Next time, I will proceed with this verification step before opening an issue here. Thanks
Command
Program
Actual behavior
The code passes the checks, but I get NPE at runtime
Expected behavior
The code should have been rejected.
The text was updated successfully, but these errors were encountered: