-
Notifications
You must be signed in to change notification settings - Fork 628
Closed
Labels
Description
Hi,
I thought it should be false negatives on IO_INEFFICIENT_INDEX_OF when using SpotBugs to analyze my project.
IO_INEFFICIENT_INDEX_OF: This code passes a constant string of length 1 to String.indexOf(). It is more efficient to use the integer implementations of String.indexOf(). f. e. call myString.indexOf('.') instead of myString.indexOf(".")
void testIIO_INEFFICIENT_INDEX_OF(int index){
StringBuilder sb = new StringBuilder();
int lastIndex = sb.indexOf(">", index);
}
It seems that SpotBugs does not do the same analysis on the StringBuilder class. Is it more efficient to use StringBuilder indexOf('.') than StringBuilder indexOf(".")?
Similar to #1928