1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
import java.text.MessageFormat;
import org.checkerframework.checker.i18nformatter.I18nFormatUtil;
import org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory;
public class IsFormat {
public static void test1(String cc) {
if (!I18nFormatUtil.isFormat(cc)) {
// :: error: (i18nformat.string.invalid)
MessageFormat.format(cc, "A");
} else {
// :: error: (i18nformat.string.invalid)
MessageFormat.format(cc, "A");
if (I18nFormatUtil.hasFormat(cc, I18nConversionCategory.GENERAL)) {
MessageFormat.format(cc, "A");
} else {
// :: error: (i18nformat.string.invalid)
MessageFormat.format(cc, "A");
}
}
}
public static void test2(String cc) {
if (!I18nFormatUtil.isFormat(cc)) {
// :: error: (i18nformat.string.invalid)
MessageFormat.format(cc, "A");
} else {
// :: error: (i18nformat.string.invalid)
MessageFormat.format(cc, "A");
if (I18nFormatUtil.hasFormat(cc, I18nConversionCategory.NUMBER)) {
MessageFormat.format(cc, 1);
} else {
// :: error: (i18nformat.string.invalid)
MessageFormat.format(cc, "A");
}
}
}
}
|