The code checks that s.indexOf(t)!=-1, then in the branch calls indexOf again with the same arguments.
These calls cannot return -1 and should be usable as an index without further checking.
Some cases can be solved by extracting the indexOf call to a local variable. However lastIndexOf should succeed as well.
Colud be solved by adding an annotation @ContainsSubstring(t).
The code checks that
s.indexOf(t)!=-1
, then in the branch callsindexOf
again with the same arguments. These calls cannot return -1 and should be usable as an index without further checking. Some cases can be solved by extracting theindexOf
call to a local variable. HoweverlastIndexOf
should succeed as well. Colud be solved by adding an annotation@ContainsSubstring(t)
.