use of org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory in project checker-framework by typetools.
the class I18nFormatterLubGlbChecker method initChecker.
@Override
public void initChecker() {
super.initChecker();
I18nFormatterTreeUtil treeUtil = new I18nFormatterTreeUtil(this);
Elements elements = getElementUtils();
AnnotationMirror I18NUNKNOWNFORMAT = AnnotationBuilder.fromClass(elements, I18nUnknownFormat.class);
AnnotationMirror I18NFORMAT = AnnotationBuilder.fromClass(elements, I18nFormat.class);
AnnotationMirror I18NINVALIDFORMAT = AnnotationBuilder.fromClass(elements, I18nInvalidFormat.class);
AnnotationMirror I18NFORMATFOR = AnnotationBuilder.fromClass(elements, I18nFormatFor.class);
AnnotationMirror I18NFORMATBOTTOM = AnnotationBuilder.fromClass(elements, I18nFormatBottom.class);
AnnotationBuilder builder = new AnnotationBuilder(processingEnv, I18nInvalidFormat.class.getCanonicalName());
builder.setValue("value", "Message");
AnnotationMirror I18nInvalidFormatWithMessage = builder.build();
builder = new AnnotationBuilder(processingEnv, I18nInvalidFormat.class.getCanonicalName());
builder.setValue("value", "Message2");
AnnotationMirror I18nInvalidFormatWithMessage2 = builder.build();
builder = new AnnotationBuilder(processingEnv, I18nInvalidFormat.class.getCanonicalName());
builder.setValue("value", "(\"Message\" or \"Message2\")");
AnnotationMirror I18nInvalidFormatWithMessagesOred = builder.build();
builder = new AnnotationBuilder(processingEnv, I18nInvalidFormat.class.getCanonicalName());
builder.setValue("value", "(\"Message\" and \"Message2\")");
AnnotationMirror I18nInvalidFormatWithMessagesAnded = builder.build();
builder = new AnnotationBuilder(processingEnv, I18nFormatFor.class.getCanonicalName());
builder.setValue("value", "#1");
AnnotationMirror I18nFormatForWithValue1 = builder.build();
builder = new AnnotationBuilder(processingEnv, I18nFormatFor.class.getCanonicalName());
builder.setValue("value", "#2");
AnnotationMirror I18nFormatForWithValue2 = builder.build();
I18nConversionCategory[] cc = new I18nConversionCategory[1];
cc[0] = I18nConversionCategory.UNUSED;
AnnotationMirror I18nFormatUnusedAnno = treeUtil.categoriesToFormatAnnotation(cc);
cc[0] = I18nConversionCategory.GENERAL;
AnnotationMirror I18nFormatGeneralAnno = treeUtil.categoriesToFormatAnnotation(cc);
cc[0] = I18nConversionCategory.DATE;
AnnotationMirror I18nFormatDateAnno = treeUtil.categoriesToFormatAnnotation(cc);
cc[0] = I18nConversionCategory.NUMBER;
AnnotationMirror I18nFormatNumberAnno = treeUtil.categoriesToFormatAnnotation(cc);
QualifierHierarchy qh = ((BaseTypeVisitor<?>) visitor).getTypeFactory().getQualifierHierarchy();
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatUnusedAnno, I18nFormatUnusedAnno), I18nFormatUnusedAnno) : "GLB of @I18nFormat(UNUSED) and @I18nFormat(UNUSED) is not @I18nFormat(UNUSED)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatUnusedAnno, I18nFormatGeneralAnno), I18nFormatUnusedAnno) : "GLB of @I18nFormat(UNUSED) and @I18nFormat(GENERAL) is not @I18nFormat(UNUSED)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatUnusedAnno, I18nFormatDateAnno), I18nFormatUnusedAnno) : "GLB of @I18nFormat(UNUSED) and @I18nFormat(DATE) is not @I18nFormat(UNUSED)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatUnusedAnno, I18nFormatNumberAnno), I18nFormatUnusedAnno) : "GLB of @I18nFormat(UNUSED) and @I18nFormat(NUMBER) is not @I18nFormat(UNUSED)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatGeneralAnno, I18nFormatUnusedAnno), I18nFormatUnusedAnno) : "GLB of @I18nFormat(GENERAL) and @I18nFormat(UNUSED) is not @I18nFormat(UNUSED)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatGeneralAnno, I18nFormatGeneralAnno), I18nFormatGeneralAnno) : "GLB of @I18nFormat(GENERAL) and @I18nFormat(GENERAL) is not @I18nFormat(GENERAL)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatGeneralAnno, I18nFormatDateAnno), I18nFormatGeneralAnno) : "GLB of @I18nFormat(GENERAL) and @I18nFormat(DATE) is not @I18nFormat(GENERAL)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatGeneralAnno, I18nFormatNumberAnno), I18nFormatGeneralAnno) : "GLB of @I18nFormat(GENERAL) and @I18nFormat(NUMBER) is not @I18nFormat(GENERAL)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatDateAnno, I18nFormatUnusedAnno), I18nFormatUnusedAnno) : "GLB of @I18nFormat(DATE) and @I18nFormat(UNUSED) is not @I18nFormat(UNUSED)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatDateAnno, I18nFormatGeneralAnno), I18nFormatGeneralAnno) : "GLB of @I18nFormat(DATE) and @I18nFormat(GENERAL) is not @I18nFormat(GENERAL)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatDateAnno, I18nFormatDateAnno), I18nFormatDateAnno) : "GLB of @I18nFormat(DATE) and @I18nFormat(DATE) is not @I18nFormat(DATE)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatDateAnno, I18nFormatNumberAnno), I18nFormatDateAnno) : "GLB of @I18nFormat(DATE) and @I18nFormat(NUMBER) is not @I18nFormat(DATE)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatNumberAnno, I18nFormatUnusedAnno), I18nFormatUnusedAnno) : "GLB of @I18nFormat(NUMBER) and @I18nFormat(UNUSED) is not @I18nFormat(UNUSED)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatNumberAnno, I18nFormatGeneralAnno), I18nFormatGeneralAnno) : "GLB of @I18nFormat(NUMBER) and @I18nFormat(GENERAL) is not @I18nFormat(GENERAL)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatNumberAnno, I18nFormatDateAnno), I18nFormatDateAnno) : "GLB of @I18nFormat(NUMBER) and @I18nFormat(DATE) is not @I18nFormat(DATE)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatNumberAnno, I18nFormatNumberAnno), I18nFormatNumberAnno) : "GLB of @I18nFormat(NUMBER) and @I18nFormat(NUMBER) is not @I18nFormat(NUMBER)!";
// Now test with two I18nConversionCategory at a time:
I18nConversionCategory[] cc2 = new I18nConversionCategory[2];
cc2[0] = I18nConversionCategory.DATE;
cc2[1] = I18nConversionCategory.DATE;
AnnotationMirror FormatTwoConvCat1 = treeUtil.categoriesToFormatAnnotation(cc2);
cc2[0] = I18nConversionCategory.UNUSED;
cc2[1] = I18nConversionCategory.NUMBER;
AnnotationMirror FormatTwoConvCat2 = treeUtil.categoriesToFormatAnnotation(cc2);
cc2[0] = I18nConversionCategory.UNUSED;
cc2[1] = I18nConversionCategory.DATE;
AnnotationMirror FormatTwoConvCat3 = treeUtil.categoriesToFormatAnnotation(cc2);
assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatTwoConvCat1, FormatTwoConvCat2), FormatTwoConvCat3) : "GLB of @I18nFormat([DATE,DATE]) and @I18nFormat([UNUSED,NUMBER]) is not @I18nFormat([UNUSED,DATE])!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatGeneralAnno, FormatTwoConvCat1), I18nFormatGeneralAnno) : "GLB of @I18nFormat(GENERAL) and @I18nFormat([DATE,DATE]) is not @I18nFormat(GENERAL)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatTwoConvCat2, I18nFormatDateAnno), I18nFormatUnusedAnno) : "GLB of @I18nFormat([UNUSED,NUMBER]) and @I18nFormat(DATE) is not @I18nFormat(UNUSED)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatForWithValue1, I18nFormatForWithValue2), I18NFORMATBOTTOM) : "GLB of @I18nFormatFor(\"#1\") and @I18nFormatFor(\"#2\") is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NUNKNOWNFORMAT, I18NUNKNOWNFORMAT), I18NUNKNOWNFORMAT) : "GLB of @I18nUnknownFormat and @I18nUnknownFormat is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NUNKNOWNFORMAT, I18NFORMAT), I18NFORMAT) : "GLB of @I18nUnknownFormat and @I18nFormat(null) is not @I18nFormat(null)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NUNKNOWNFORMAT, I18nFormatUnusedAnno), I18nFormatUnusedAnno) : "GLB of @I18nUnknownFormat and @I18nFormat(UNUSED) is not @I18nFormat(UNUSED)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NUNKNOWNFORMAT, I18NINVALIDFORMAT), I18NINVALIDFORMAT) : "GLB of @I18nUnknownFormat and @I18nInvalidFormat(null) is not @I18nInvalidFormat(null)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NUNKNOWNFORMAT, I18nInvalidFormatWithMessage), I18nInvalidFormatWithMessage) : "GLB of @I18nUnknownFormat and @I18nInvalidFormat(\"Message\") is not @I18nInvalidFormat(\"Message\")!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NUNKNOWNFORMAT, I18NFORMATFOR), I18NFORMATFOR) : "GLB of @I18nUnknownFormat and @I18nFormatFor(null) is not @I18nFormatFor(null)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NUNKNOWNFORMAT, I18nFormatForWithValue1), I18nFormatForWithValue1) : "GLB of @I18nUnknownFormat and @I18nFormatFor(\"#1\") is not @I18nFormatFor(\"#1\")!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NUNKNOWNFORMAT, I18NFORMATBOTTOM), I18NFORMATBOTTOM) : "GLB of @I18nUnknownFormat and @I18nFormatBottom is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMAT, I18NUNKNOWNFORMAT), I18NFORMAT) : "GLB of @I18nFormat(null) and @I18nUnknownFormat is not @I18nFormat(null)!";
// practice. Skipping this case as it causes an expected crash.
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMAT, I18NINVALIDFORMAT), I18NFORMATBOTTOM) : "GLB of @I18nFormat(null) and @I18nInvalidFormat(null) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMAT, I18nInvalidFormatWithMessage), I18NFORMATBOTTOM) : "GLB of @I18nFormat(null) and @I18nInvalidFormat(\"Message\") is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMAT, I18NFORMATFOR), I18NFORMATBOTTOM) : "GLB of @I18nFormat(null) and @I18nFormatFor(null) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMAT, I18nFormatForWithValue1), I18NFORMATBOTTOM) : "GLB of @I18nFormat(null) and @I18nFormatFor(\"#1\") is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMAT, I18NFORMATBOTTOM), I18NFORMATBOTTOM) : "GLB of @I18nFormat(null) and @I18nFormatBottom is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatUnusedAnno, I18NUNKNOWNFORMAT), I18nFormatUnusedAnno) : "GLB of @I18nFormat(UNUSED) and @I18nUnknownFormat is not @I18nFormat(UNUSED)!";
// practice. Skipping this case as it causes an expected crash.
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatUnusedAnno, I18nFormatUnusedAnno), I18nFormatUnusedAnno) : "GLB of @I18nFormat(UNUSED) and @I18nFormat(UNUSED) is not @I18nFormat(UNUSED)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatUnusedAnno, I18NINVALIDFORMAT), I18NFORMATBOTTOM) : "GLB of @I18nFormat(UNUSED) and @I18nInvalidFormat(null) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatUnusedAnno, I18nInvalidFormatWithMessage), I18NFORMATBOTTOM) : "GLB of @I18nFormat(UNUSED) and @I18nInvalidFormat(\"Message\") is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatUnusedAnno, I18NFORMATFOR), I18NFORMATBOTTOM) : "GLB of @I18nFormat(UNUSED) and @I18nFormatFor(null) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatUnusedAnno, I18nFormatForWithValue1), I18NFORMATBOTTOM) : "GLB of @I18nFormat(UNUSED) and @I18nFormatFor(\"#1\") is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatUnusedAnno, I18NFORMATBOTTOM), I18NFORMATBOTTOM) : "GLB of @I18nFormat(UNUSED) and @I18nFormatBottom is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NINVALIDFORMAT, I18NUNKNOWNFORMAT), I18NINVALIDFORMAT) : "GLB of @I18nInvalidFormat(null) and @I18nUnknownFormat is not @I18nInvalidFormat(null)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NINVALIDFORMAT, I18NFORMAT), I18NFORMATBOTTOM) : "GLB of @I18nInvalidFormat(null) and @I18nFormat(null) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NINVALIDFORMAT, I18nFormatUnusedAnno), I18NFORMATBOTTOM) : "GLB of @I18nInvalidFormat(null) and @I18nFormat(UNUSED) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NINVALIDFORMAT, I18NFORMATFOR), I18NFORMATBOTTOM) : "GLB of @I18nInvalidFormat(null) and @I18nFormatFor(null) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NINVALIDFORMAT, I18nFormatForWithValue1), I18NFORMATBOTTOM) : "GLB of @I18nInvalidFormat(null) and @I18nFormatFor(\"#1\") is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NINVALIDFORMAT, I18NFORMATBOTTOM), I18NFORMATBOTTOM) : "GLB of @I18nInvalidFormat(null) and @I18nFormatBottom is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nInvalidFormatWithMessage, I18NUNKNOWNFORMAT), I18nInvalidFormatWithMessage) : "GLB of @I18nInvalidFormat(\"Message\") and @I18nUnknownFormat is not @I18nInvalidFormat(\"Message\")!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nInvalidFormatWithMessage, I18NFORMAT), I18NFORMATBOTTOM) : "GLB of @I18nInvalidFormat(\"Message\") and @I18nFormat(null) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nInvalidFormatWithMessage, I18nFormatUnusedAnno), I18NFORMATBOTTOM) : "GLB of @I18nInvalidFormat(\"Message\") and @I18nFormat(UNUSED) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nInvalidFormatWithMessage, I18nInvalidFormatWithMessage), I18nInvalidFormatWithMessage) : "GLB of @I18nInvalidFormat(\"Message\") and @I18nInvalidFormat(\"Message\") is not @I18nInvalidFormat(\"Message\")!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nInvalidFormatWithMessage, I18nInvalidFormatWithMessage2), I18nInvalidFormatWithMessagesAnded) : "GLB of @I18nInvalidFormat(\"Message\") and @I18nInvalidFormat(\"Message2\") is not @I18nInvalidFormat(\"(\"Message\" and \"Message2\")\")!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nInvalidFormatWithMessage, I18NFORMATFOR), I18NFORMATBOTTOM) : "GLB of @I18nInvalidFormat(\"Message\") and @I18nFormatFor(null) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nInvalidFormatWithMessage, I18nFormatForWithValue1), I18NFORMATBOTTOM) : "GLB of @I18nInvalidFormat(\"Message\") and @I18nFormatFor(\"#1\") is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nInvalidFormatWithMessage, I18NFORMATBOTTOM), I18NFORMATBOTTOM) : "GLB of @I18nInvalidFormat(\"Message\") and @I18nFormatBottom is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMATFOR, I18NUNKNOWNFORMAT), I18NFORMATFOR) : "GLB of @I18nFormatFor(null) and @I18nUnknownFormat is not @I18nFormatFor(null)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMATFOR, I18NFORMAT), I18NFORMATBOTTOM) : "GLB of @I18nFormatFor(null) and @I18nFormat(null) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMATFOR, I18nFormatUnusedAnno), I18NFORMATBOTTOM) : "GLB of @I18nFormatFor(null) and @I18nFormat(UNUSED) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMATFOR, I18NINVALIDFORMAT), I18NFORMATBOTTOM) : "GLB of @I18nFormatFor(null) and @I18nInvalidFormat(null) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMATFOR, I18nInvalidFormatWithMessage), I18NFORMATBOTTOM) : "GLB of @I18nFormatFor(null) and @I18nInvalidFormat(\"Message\") is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMATFOR, I18NFORMATFOR), I18NFORMATFOR) : "GLB of @I18nFormatFor(null) and @I18nFormatFor(null) is not @I18nFormatFor(null)!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMATFOR, I18nFormatForWithValue1), I18NFORMATBOTTOM) : "GLB of @I18nFormatFor(null) and @I18nFormatFor(\"#1\") is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMATFOR, I18NFORMATBOTTOM), I18NFORMATBOTTOM) : "GLB of @I18nFormatFor(null) and @I18nFormatBottom is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatForWithValue1, I18NUNKNOWNFORMAT), I18nFormatForWithValue1) : "GLB of @I18nFormatFor(\"#1\") and @I18nUnknownFormat is not @I18nFormatFor(\"#1\")!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatForWithValue1, I18NFORMAT), I18NFORMATBOTTOM) : "GLB of @I18nFormatFor(\"#1\") and @I18nFormat(null) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatForWithValue1, I18nFormatUnusedAnno), I18NFORMATBOTTOM) : "GLB of @I18nFormatFor(\"#1\") and @I18nFormat(UNUSED) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatForWithValue1, I18NINVALIDFORMAT), I18NFORMATBOTTOM) : "GLB of @I18nFormatFor(\"#1\") and @I18nInvalidFormat(null) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatForWithValue1, I18nInvalidFormatWithMessage), I18NFORMATBOTTOM) : "GLB of @I18nFormatFor(\"#1\") and @I18nInvalidFormat(\"Message\") is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatForWithValue1, I18NFORMATFOR), I18NFORMATBOTTOM) : "GLB of @I18nFormatFor(\"#1\") and @I18nFormatFor(null) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatForWithValue1, I18nFormatForWithValue1), I18nFormatForWithValue1) : "GLB of @I18nFormatFor(\"#1\") and @I18nFormatFor(\"#1\") is not @I18nFormatFor(\"#1\")!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18nFormatForWithValue1, I18NFORMATBOTTOM), I18NFORMATBOTTOM) : "GLB of @I18nFormatFor(\"#1\") and @I18nFormatBottom is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMATBOTTOM, I18NUNKNOWNFORMAT), I18NFORMATBOTTOM) : "GLB of @I18nFormatBottom and @I18nUnknownFormat is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMATBOTTOM, I18NFORMAT), I18NFORMATBOTTOM) : "GLB of @I18nFormatBottom and @I18nFormat(null) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMATBOTTOM, I18nFormatUnusedAnno), I18NFORMATBOTTOM) : "GLB of @I18nFormatBottom and @I18nFormat(UNUSED) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMATBOTTOM, I18NINVALIDFORMAT), I18NFORMATBOTTOM) : "GLB of @I18nFormatBottom and @I18nInvalidFormat(null) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMATBOTTOM, I18nInvalidFormatWithMessage), I18NFORMATBOTTOM) : "GLB of @I18nFormatBottom and @I18nInvalidFormat(\"Message\") is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMATBOTTOM, I18NFORMATFOR), I18NFORMATBOTTOM) : "GLB of @I18nFormatBottom and @I18nFormatFor(null) is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMATBOTTOM, I18nFormatForWithValue1), I18NFORMATBOTTOM) : "GLB of @I18nFormatBottom and @I18nFormatFor(\"#1\") is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.greatestLowerBound(I18NFORMATBOTTOM, I18NFORMATBOTTOM), I18NFORMATBOTTOM) : "GLB of @I18nFormatBottom and @I18nFormatBottom is not @I18nFormatBottom!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatUnusedAnno, I18nFormatUnusedAnno), I18nFormatUnusedAnno) : "LUB of @I18nFormat(UNUSED) and @I18nFormat(UNUSED) is not @I18nFormat(UNUSED)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatUnusedAnno, I18nFormatGeneralAnno), I18nFormatGeneralAnno) : "LUB of @I18nFormat(UNUSED) and @I18nFormat(GENERAL) is not @I18nFormat(GENERAL)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatUnusedAnno, I18nFormatDateAnno), I18nFormatDateAnno) : "LUB of @I18nFormat(UNUSED) and @I18nFormat(DATE) is not @I18nFormat(DATE)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatUnusedAnno, I18nFormatNumberAnno), I18nFormatNumberAnno) : "LUB of @I18nFormat(UNUSED) and @I18nFormat(NUMBER) is not @I18nFormat(NUMBER)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatGeneralAnno, I18nFormatUnusedAnno), I18nFormatGeneralAnno) : "LUB of @I18nFormat(GENERAL) and @I18nFormat(UNUSED) is not @I18nFormat(GENERAL)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatGeneralAnno, I18nFormatGeneralAnno), I18nFormatGeneralAnno) : "LUB of @I18nFormat(GENERAL) and @I18nFormat(GENERAL) is not @I18nFormat(GENERAL)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatGeneralAnno, I18nFormatDateAnno), I18nFormatDateAnno) : "LUB of @I18nFormat(GENERAL) and @I18nFormat(DATE) is not @I18nFormat(DATE)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatGeneralAnno, I18nFormatNumberAnno), I18nFormatNumberAnno) : "LUB of @I18nFormat(GENERAL) and @I18nFormat(NUMBER) is not @I18nFormat(NUMBER)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatDateAnno, I18nFormatUnusedAnno), I18nFormatDateAnno) : "LUB of @I18nFormat(DATE) and @I18nFormat(UNUSED) is not @I18nFormat(DATE)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatDateAnno, I18nFormatGeneralAnno), I18nFormatDateAnno) : "LUB of @I18nFormat(DATE) and @I18nFormat(GENERAL) is not @I18nFormat(DATE)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatDateAnno, I18nFormatDateAnno), I18nFormatDateAnno) : "LUB of @I18nFormat(DATE) and @I18nFormat(DATE) is not @I18nFormat(DATE)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatDateAnno, I18nFormatNumberAnno), I18nFormatNumberAnno) : "LUB of @I18nFormat(DATE) and @I18nFormat(NUMBER) is not @I18nFormat(NUMBER)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatNumberAnno, I18nFormatUnusedAnno), I18nFormatNumberAnno) : "LUB of @I18nFormat(NUMBER) and @I18nFormat(UNUSED) is not @I18nFormat(NUMBER)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatNumberAnno, I18nFormatGeneralAnno), I18nFormatNumberAnno) : "LUB of @I18nFormat(NUMBER) and @I18nFormat(GENERAL) is not @I18nFormat(NUMBER)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatNumberAnno, I18nFormatDateAnno), I18nFormatNumberAnno) : "LUB of @I18nFormat(NUMBER) and @I18nFormat(DATE) is not @I18nFormat(NUMBER)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatNumberAnno, I18nFormatNumberAnno), I18nFormatNumberAnno) : "LUB of @I18nFormat(NUMBER) and @I18nFormat(NUMBER) is not @I18nFormat(NUMBER)!";
// Now test with two I18nConversionCategory at a time:
cc2[0] = I18nConversionCategory.DATE;
cc2[1] = I18nConversionCategory.NUMBER;
AnnotationMirror FormatTwoConvCat4 = treeUtil.categoriesToFormatAnnotation(cc2);
assert AnnotationUtils.areSame(qh.leastUpperBound(FormatTwoConvCat1, FormatTwoConvCat2), FormatTwoConvCat4) : "LUB of @I18nFormat([DATE,DATE]) and @I18nFormat([UNUSED,NUMBER]) is not @I18nFormat([DATE,NUMBER])!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatGeneralAnno, FormatTwoConvCat1), FormatTwoConvCat1) : "LUB of @I18nFormat(GENERAL) and @I18nFormat([DATE,DATE]) is not @I18nFormat([DATE,DATE])!";
assert AnnotationUtils.areSame(qh.leastUpperBound(FormatTwoConvCat2, I18nFormatDateAnno), FormatTwoConvCat4) : "LUB of @I18nFormat([UNUSED,NUMBER]) and @I18nFormat(DATE) is not @I18nFormat([DATE,NUMBER])!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatForWithValue1, I18nFormatForWithValue2), I18NUNKNOWNFORMAT) : "LUB of @I18nFormatFor(\"#1\") and @I18nFormatFor(\"#2\") is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NUNKNOWNFORMAT, I18NUNKNOWNFORMAT), I18NUNKNOWNFORMAT) : "LUB of @I18nUnknownFormat and @I18nUnknownFormat is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NUNKNOWNFORMAT, I18NFORMAT), I18NUNKNOWNFORMAT) : "LUB of @I18nUnknownFormat and @I18nFormat(null) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NUNKNOWNFORMAT, I18nFormatUnusedAnno), I18NUNKNOWNFORMAT) : "LUB of @I18nUnknownFormat and @I18nFormat(UNUSED) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NUNKNOWNFORMAT, I18NINVALIDFORMAT), I18NUNKNOWNFORMAT) : "LUB of @I18nUnknownFormat and @I18nInvalidFormat(null) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NUNKNOWNFORMAT, I18nInvalidFormatWithMessage), I18NUNKNOWNFORMAT) : "LUB of @I18nUnknownFormat and @I18nInvalidFormat(\"Message\") is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NUNKNOWNFORMAT, I18NFORMATFOR), I18NUNKNOWNFORMAT) : "LUB of @I18nUnknownFormat and @I18nFormatFor(null) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NUNKNOWNFORMAT, I18nFormatForWithValue1), I18NUNKNOWNFORMAT) : "LUB of @I18nUnknownFormat and @I18nFormatFor(\"#1\") is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NUNKNOWNFORMAT, I18NFORMATBOTTOM), I18NUNKNOWNFORMAT) : "LUB of @I18nUnknownFormat and @I18nFormatBottom is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMAT, I18NUNKNOWNFORMAT), I18NUNKNOWNFORMAT) : "LUB of @I18nFormat(null) and @I18nUnknownFormat is not @I18nUnknownFormat!";
// practice. Skipping this case as it causes an expected crash.
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMAT, I18NINVALIDFORMAT), I18NUNKNOWNFORMAT) : "LUB of @I18nFormat(null) and @I18nInvalidFormat(null) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMAT, I18nInvalidFormatWithMessage), I18NUNKNOWNFORMAT) : "LUB of @I18nFormat(null) and @I18nInvalidFormat(\"Message\") is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMAT, I18NFORMATFOR), I18NUNKNOWNFORMAT) : "LUB of @I18nFormat(null) and @I18nFormatFor(null) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMAT, I18nFormatForWithValue1), I18NUNKNOWNFORMAT) : "LUB of @I18nFormat(null) and @I18nFormatFor(\"#1\") is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMAT, I18NFORMATBOTTOM), I18NFORMAT) : "LUB of @I18nFormat(null) and @I18nFormatBottom is not @I18nFormat(null)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatUnusedAnno, I18NUNKNOWNFORMAT), I18NUNKNOWNFORMAT) : "LUB of @I18nFormat(UNUSED) and @I18nUnknownFormat is not @I18nUnknownFormat!";
// practice. Skipping this case as it causes an expected crash.
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatUnusedAnno, I18nFormatUnusedAnno), I18nFormatUnusedAnno) : "LUB of @I18nFormat(UNUSED) and @I18nFormat(UNUSED) is not @I18nFormat(UNUSED)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatUnusedAnno, I18NINVALIDFORMAT), I18NUNKNOWNFORMAT) : "LUB of @I18nFormat(UNUSED) and @I18nInvalidFormat(null) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatUnusedAnno, I18nInvalidFormatWithMessage), I18NUNKNOWNFORMAT) : "LUB of @I18nFormat(UNUSED) and @I18nInvalidFormat(\"Message\") is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatUnusedAnno, I18NFORMATFOR), I18NUNKNOWNFORMAT) : "LUB of @I18nFormat(UNUSED) and @I18nFormatFor(null) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatUnusedAnno, I18nFormatForWithValue1), I18NUNKNOWNFORMAT) : "LUB of @I18nFormat(UNUSED) and @I18nFormatFor(\"#1\") is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatUnusedAnno, I18NFORMATBOTTOM), I18nFormatUnusedAnno) : "LUB of @I18nFormat(UNUSED) and @I18nFormatBottom is not @I18nFormat(UNUSED)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NINVALIDFORMAT, I18NUNKNOWNFORMAT), I18NUNKNOWNFORMAT) : "LUB of @I18nInvalidFormat(null) and @I18nUnknownFormat is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NINVALIDFORMAT, I18NFORMAT), I18NUNKNOWNFORMAT) : "LUB of @I18nInvalidFormat(null) and @I18nFormat(null) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NINVALIDFORMAT, I18nFormatUnusedAnno), I18NUNKNOWNFORMAT) : "LUB of @I18nInvalidFormat(null) and @I18nFormat(UNUSED) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NINVALIDFORMAT, I18NFORMATFOR), I18NUNKNOWNFORMAT) : "LUB of @I18nInvalidFormat(null) and @I18nFormatFor(null) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NINVALIDFORMAT, I18nFormatForWithValue1), I18NUNKNOWNFORMAT) : "LUB of @I18nInvalidFormat(null) and @I18nFormatFor(\"#1\") is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NINVALIDFORMAT, I18NFORMATBOTTOM), I18NINVALIDFORMAT) : "LUB of @I18nInvalidFormat(null) and @I18nFormatBottom is not @I18nInvalidFormat(null)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nInvalidFormatWithMessage, I18NUNKNOWNFORMAT), I18NUNKNOWNFORMAT) : "LUB of @I18nInvalidFormat(\"Message\") and @I18nUnknownFormat is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nInvalidFormatWithMessage, I18NFORMAT), I18NUNKNOWNFORMAT) : "LUB of @I18nInvalidFormat(\"Message\") and @I18nFormat(null) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nInvalidFormatWithMessage, I18nFormatUnusedAnno), I18NUNKNOWNFORMAT) : "LUB of @I18nInvalidFormat(\"Message\") and @I18nFormat(UNUSED) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nInvalidFormatWithMessage, I18nInvalidFormatWithMessage), I18nInvalidFormatWithMessage) : "LUB of @I18nInvalidFormat(\"Message\") and @I18nInvalidFormat(\"Message\") is not @I18nInvalidFormat(\"Message\")!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nInvalidFormatWithMessage, I18nInvalidFormatWithMessage2), I18nInvalidFormatWithMessagesOred) : "LUB of @I18nInvalidFormat(\"Message\") and @I18nInvalidFormat(\"Message2\") is not @I18nInvalidFormat(\"(\"Message\" or \"Message2\")\")!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nInvalidFormatWithMessage, I18NFORMATFOR), I18NUNKNOWNFORMAT) : "LUB of @I18nInvalidFormat(\"Message\") and @I18nFormatFor(null) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nInvalidFormatWithMessage, I18nFormatForWithValue1), I18NUNKNOWNFORMAT) : "LUB of @I18nInvalidFormat(\"Message\") and @I18nFormatFor(\"#1\") is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nInvalidFormatWithMessage, I18NFORMATBOTTOM), I18nInvalidFormatWithMessage) : "LUB of @I18nInvalidFormat(\"Message\") and @I18nFormatBottom is not @I18nInvalidFormat(\"Message\")!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMATFOR, I18NUNKNOWNFORMAT), I18NUNKNOWNFORMAT) : "LUB of @I18nFormatFor(null) and @I18nUnknownFormat is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMATFOR, I18NFORMAT), I18NUNKNOWNFORMAT) : "LUB of @I18nFormatFor(null) and @I18nFormat(null) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMATFOR, I18nFormatUnusedAnno), I18NUNKNOWNFORMAT) : "LUB of @I18nFormatFor(null) and @I18nFormat(UNUSED) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMATFOR, I18NINVALIDFORMAT), I18NUNKNOWNFORMAT) : "LUB of @I18nFormatFor(null) and @I18nInvalidFormat(null) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMATFOR, I18nInvalidFormatWithMessage), I18NUNKNOWNFORMAT) : "LUB of @I18nFormatFor(null) and @I18nInvalidFormat(\"Message\") is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMATFOR, I18NFORMATFOR), I18NFORMATFOR) : "LUB of @I18nFormatFor(null) and @I18nFormatFor(null) is not @I18nFormatFor(null)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMATFOR, I18nFormatForWithValue1), I18NUNKNOWNFORMAT) : "LUB of @I18nFormatFor(null) and @I18nFormatFor(\"#1\") is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMATFOR, I18NFORMATBOTTOM), I18NFORMATFOR) : "LUB of @I18nFormatFor(null) and @I18nFormatBottom is not @I18nFormatFor(null)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatForWithValue1, I18NUNKNOWNFORMAT), I18NUNKNOWNFORMAT) : "LUB of @I18nFormatFor(\"#1\") and @I18nUnknownFormat is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatForWithValue1, I18NFORMAT), I18NUNKNOWNFORMAT) : "LUB of @I18nFormatFor(\"#1\") and @I18nFormat(null) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatForWithValue1, I18nFormatUnusedAnno), I18NUNKNOWNFORMAT) : "LUB of @I18nFormatFor(\"#1\") and @I18nFormat(UNUSED) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatForWithValue1, I18NINVALIDFORMAT), I18NUNKNOWNFORMAT) : "LUB of @I18nFormatFor(\"#1\") and @I18nInvalidFormat(null) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatForWithValue1, I18nInvalidFormatWithMessage), I18NUNKNOWNFORMAT) : "LUB of @I18nFormatFor(\"#1\") and @I18nInvalidFormat(\"Message\") is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatForWithValue1, I18NFORMATFOR), I18NUNKNOWNFORMAT) : "LUB of @I18nFormatFor(\"#1\") and @I18nFormatFor(null) is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatForWithValue1, I18nFormatForWithValue1), I18nFormatForWithValue1) : "LUB of @I18nFormatFor(\"#1\") and @I18nFormatFor(\"#1\") is not @I18nFormatFor(\"#1\")!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18nFormatForWithValue1, I18NFORMATBOTTOM), I18nFormatForWithValue1) : "LUB of @I18nFormatFor(\"#1\") and @I18nFormatBottom is not @I18nFormatFor(\"#1\")!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMATBOTTOM, I18NUNKNOWNFORMAT), I18NUNKNOWNFORMAT) : "LUB of @I18nFormatBottom and @I18nUnknownFormat is not @I18nUnknownFormat!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMATBOTTOM, I18NFORMAT), I18NFORMAT) : "LUB of @I18nFormatBottom and @I18nFormat(null) is not @I18nFormat(null)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMATBOTTOM, I18nFormatUnusedAnno), I18nFormatUnusedAnno) : "LUB of @I18nFormatBottom and @I18nFormat(UNUSED) is not @I18nFormat(UNUSED)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMATBOTTOM, I18NINVALIDFORMAT), I18NINVALIDFORMAT) : "LUB of @I18nFormatBottom and @I18nInvalidFormat(null) is not @I18nInvalidFormat(null)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMATBOTTOM, I18nInvalidFormatWithMessage), I18nInvalidFormatWithMessage) : "LUB of @I18nFormatBottom and @I18nInvalidFormat(\"Message\") is not @I18nInvalidFormat(\"Message\")!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMATBOTTOM, I18NFORMATFOR), I18NFORMATFOR) : "LUB of @I18nFormatBottom and @I18nFormatFor(null) is not @I18nFormatFor(null)!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMATBOTTOM, I18nFormatForWithValue1), I18nFormatForWithValue1) : "LUB of @I18nFormatBottom and @I18nFormatFor(\"#1\") is not @I18nFormatFor(\"#1\")!";
assert AnnotationUtils.areSame(qh.leastUpperBound(I18NFORMATBOTTOM, I18NFORMATBOTTOM), I18NFORMATBOTTOM) : "LUB of @I18nFormatBottom and @I18nFormatBottom is not @I18nFormatBottom!";
}
use of org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory in project checker-framework by typetools.
the class I18nFormatterTreeUtil method asFormatCallCategoriesLowLevel.
private I18nConversionCategory[] asFormatCallCategoriesLowLevel(MethodInvocationNode node) {
Node vararg = node.getArgument(1);
if (vararg instanceof ArrayCreationNode) {
List<Node> convs = ((ArrayCreationNode) vararg).getInitializers();
I18nConversionCategory[] res = new I18nConversionCategory[convs.size()];
for (int i = 0; i < convs.size(); i++) {
Node conv = convs.get(i);
if (conv instanceof FieldAccessNode) {
if (typeMirrorToClass(((FieldAccessNode) conv).getType()) == I18nConversionCategory.class) {
res[i] = I18nConversionCategory.valueOf(((FieldAccessNode) conv).getFieldName());
continue;
/* avoid returning null */
}
}
return null;
}
return res;
}
return null;
}
use of org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory in project checker-framework by typetools.
the class I18nFormatterVisitor method checkInvocationFormatFor.
private void checkInvocationFormatFor(I18nFormatCall fc) {
I18nFormatterTreeUtil tu = atypeFactory.treeUtil;
Result<FormatType> type = fc.getFormatType();
Result<InvocationType> invc;
I18nConversionCategory[] formatCats;
switch(type.value()) {
case I18NINVALID:
tu.failure(type, "i18nformat.string.invalid", fc.getInvalidError());
break;
case I18NFORMATFOR:
if (!fc.isValidFormatForInvocation()) {
Result<FormatType> failureType = fc.getInvalidInvocationType();
tu.failure(failureType, "i18nformat.invalid.formatfor");
}
break;
case I18NFORMAT:
invc = fc.getInvocationType();
formatCats = fc.getFormatCategories();
switch(invc.value()) {
case VARARG:
Result<TypeMirror>[] paramTypes = fc.getParamTypes();
int paraml = paramTypes.length;
int formatl = formatCats.length;
// from commonAssignmentCheck.
if (paraml < formatl) {
tu.warning(invc, "i18nformat.missing.arguments", formatl, paraml);
}
if (paraml > formatl) {
tu.warning(invc, "i18nformat.excess.arguments", formatl, paraml);
}
for (int i = 0; i < formatl && i < paraml; ++i) {
I18nConversionCategory formatCat = formatCats[i];
Result<TypeMirror> param = paramTypes[i];
TypeMirror paramType = param.value();
switch(formatCat) {
case UNUSED:
tu.warning(param, "i18nformat.argument.unused", " " + (1 + i));
break;
case GENERAL:
break;
default:
if (!fc.isValidParameter(formatCat, paramType)) {
tu.failure(param, "argument.type.incompatible", paramType, formatCat);
}
}
}
break;
case NULLARRAY:
// fall-through
case ARRAY:
for (I18nConversionCategory cat : formatCats) {
if (cat == I18nConversionCategory.UNUSED) {
tu.warning(invc, "i18nformat.argument.unused", "");
}
}
tu.warning(invc, "i18nformat.indirect.arguments");
break;
default:
break;
}
break;
default:
break;
}
}
use of org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory in project checker-framework by typetools.
the class I18nFormatterVisitor method commonAssignmentCheck.
@Override
protected void commonAssignmentCheck(AnnotatedTypeMirror varType, AnnotatedTypeMirror valueType, Tree valueTree, @CompilerMessageKey String errorKey) {
AnnotationMirror rhs = valueType.getAnnotationInHierarchy(atypeFactory.I18NUNKNOWNFORMAT);
AnnotationMirror lhs = varType.getAnnotationInHierarchy(atypeFactory.I18NUNKNOWNFORMAT);
// For method calls, they are issued in checkInvocationFormatFor.
if (AnnotationUtils.areSameIgnoringValues(rhs, atypeFactory.I18NFORMAT) && AnnotationUtils.areSameIgnoringValues(lhs, atypeFactory.I18NFORMAT)) {
I18nConversionCategory[] rhsArgTypes = atypeFactory.treeUtil.formatAnnotationToCategories(rhs);
I18nConversionCategory[] lhsArgTypes = atypeFactory.treeUtil.formatAnnotationToCategories(lhs);
if (rhsArgTypes.length < lhsArgTypes.length) {
// From the manual:
// It is legal to use a format string with fewer format specifiers
// than required, but a warning is issued.
checker.report(org.checkerframework.framework.source.Result.warning("i18nformat.missing.arguments", varType.toString(), valueType.toString()), valueTree);
} else if (rhsArgTypes.length > lhsArgTypes.length) {
// Since it is known that too many conversion categories were provided,
// issue a more specific error message to that effect than
// assignment.type.incompatible.
checker.report(org.checkerframework.framework.source.Result.failure("i18nformat.excess.arguments", varType.toString(), valueType.toString()), valueTree);
}
}
// By calling super.commonAssignmentCheck last, any i18nformat.excess.arguments message
// issued for a given line of code will take precedence over the
// assignment.type.incompatible
// issued by super.commonAssignmentCheck.
super.commonAssignmentCheck(varType, valueType, valueTree, errorKey);
}
Aggregations