panacekcz / checker-framework

Pluggable type-checking for Java
http://checkerframework.org/
Other
0 stars 0 forks source link

Length refinement after a.indexOf(s)!=-1 #18

Open panacekcz opened 6 years ago

panacekcz commented 6 years ago

When a.indexOf(s)!=-1 is checked, the length of a could be refined the same as it is for startsWith or endsWith (#1432).

panacekcz commented 6 years ago

The single occurence in daikon uses a local variable, so detecting the expression directly would not work. If the @IndexOf annotation described in #1461 is implemented, then it could be done: if i is @IndexOf(value="a",in="s"), then i!=-1 would refine s to @MinLen of a. Possibly could work also with @IndexOfIndexFor if the offset expression is of the right form.

panacekcz commented 6 years ago

Duplicate of kelloggm#169