-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Here's a small example:
class Test {
boolean test(@Nullable String str) {
if (str == null) {
return false;
}
int index = str.indexOf(' ');
String className = index == -1 ? str : str.substring(0, index);
return className.equals("X");
}
}
Generates this warning message:
Test.java:10: warning: [method.evaluation.exception] Failed to evaluate method
public java.lang.String java.lang.String.substring(int,int) because it threw an
exception: java.lang.StringIndexOutOfBoundsException: String index out of
range: -1. Treating result as @UnknownVal
String className = index == -1 ? str : str.substring(0, index);
^
It seems harmless as far I can tell so far.
Original issue reported on code.google.com by trask.st...@gmail.com on 19 Apr 2015 at 7:22
Metadata
Metadata
Assignees
Labels
No labels