Closed panacekcz closed 6 years ago
Currently, the following code causes a upper bound checker warning, although it is safe:
import java.util.StringTokenizer;
class StringTokenizerMinLen {
void test(String str, String delim, boolean returnDelims) {
StringTokenizer st = new StringTokenizer(str, delim, returnDelims);
while (st.hasMoreTokens()) {
char c = st.nextToken().charAt(0);
}
}
}
Because of kelloggm#165, char c = st.nextToken().charAt(0);
will not work even after this annotation is added. However, String token = st.nextToken(); char c = token.charAt(0);
will work.
StringTokenizer.nextToken
always returns non-empty strings, so its return type could be@MinLen(1)
.