panacekcz / checker-framework

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

Case study on Daikon #7

Open panacekcz opened 7 years ago

panacekcz commented 7 years ago

The Index checker with all string-related changes merged has been run on daikon. All array warnings have been ignored.

String warnings

False positives

Due to a limitation in the index checker, it issued a warning for a correct code.

(1) #9: Length refinement by startsWith, endsWith with a static final variable

This pattern is currently supported for literals, but does not work when a static final variable is used instead. Reported as argument.type.incompatible when calling substring.

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). Reported as lowerbound:argument.type.incompatible when calling substring.