Search in sources :

Example 26 with AnnotationBuilder

use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.

the class FormatterLubGlbChecker method initChecker.

@Override
public void initChecker() {
    super.initChecker();
    FormatterTreeUtil treeUtil = new FormatterTreeUtil(this);
    Elements elements = getElementUtils();
    AnnotationMirror UNKNOWNFORMAT = AnnotationBuilder.fromClass(elements, UnknownFormat.class);
    AnnotationMirror FORMAT = AnnotationBuilder.fromClass(elements, Format.class);
    AnnotationMirror INVALIDFORMAT = AnnotationBuilder.fromClass(elements, InvalidFormat.class);
    AnnotationMirror FORMATBOTTOM = AnnotationBuilder.fromClass(elements, FormatBottom.class);
    AnnotationBuilder builder = new AnnotationBuilder(processingEnv, InvalidFormat.class.getCanonicalName());
    builder.setValue("value", "Message");
    AnnotationMirror InvalidFormatWithMessage = builder.build();
    builder = new AnnotationBuilder(processingEnv, InvalidFormat.class.getCanonicalName());
    builder.setValue("value", "Message2");
    AnnotationMirror InvalidFormatWithMessage2 = builder.build();
    builder = new AnnotationBuilder(processingEnv, InvalidFormat.class.getCanonicalName());
    builder.setValue("value", "(\"Message\" or \"Message2\")");
    AnnotationMirror InvalidFormatWithMessagesOred = builder.build();
    builder = new AnnotationBuilder(processingEnv, InvalidFormat.class.getCanonicalName());
    builder.setValue("value", "(\"Message\" and \"Message2\")");
    AnnotationMirror InvalidFormatWithMessagesAnded = builder.build();
    ConversionCategory[] cc = new ConversionCategory[1];
    cc[0] = ConversionCategory.UNUSED;
    AnnotationMirror FormatUnusedAnno = treeUtil.categoriesToFormatAnnotation(cc);
    cc[0] = ConversionCategory.GENERAL;
    AnnotationMirror FormatGeneralAnno = treeUtil.categoriesToFormatAnnotation(cc);
    cc[0] = ConversionCategory.CHAR;
    AnnotationMirror FormatCharAnno = treeUtil.categoriesToFormatAnnotation(cc);
    cc[0] = ConversionCategory.INT;
    AnnotationMirror FormatIntAnno = treeUtil.categoriesToFormatAnnotation(cc);
    cc[0] = ConversionCategory.TIME;
    AnnotationMirror FormatTimeAnno = treeUtil.categoriesToFormatAnnotation(cc);
    cc[0] = ConversionCategory.FLOAT;
    AnnotationMirror FormatFloatAnno = treeUtil.categoriesToFormatAnnotation(cc);
    cc[0] = ConversionCategory.CHAR_AND_INT;
    AnnotationMirror FormatCharAndIntAnno = treeUtil.categoriesToFormatAnnotation(cc);
    cc[0] = ConversionCategory.INT_AND_TIME;
    AnnotationMirror FormatIntAndTimeAnno = treeUtil.categoriesToFormatAnnotation(cc);
    cc[0] = ConversionCategory.NULL;
    AnnotationMirror FormatNullAnno = treeUtil.categoriesToFormatAnnotation(cc);
    QualifierHierarchy qh = ((BaseTypeVisitor<?>) visitor).getTypeFactory().getQualifierHierarchy();
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAndIntAnno, FormatIntAndTimeAnno), FormatIntAnno) : "GLB of @Format(CHAR_AND_INT) and @Format(INT_AND_TIME) is not @Format(INT)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatUnusedAnno, FormatUnusedAnno), FormatUnusedAnno) : "GLB of @Format(UNUSED) and @Format(UNUSED) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatUnusedAnno, FormatGeneralAnno), FormatUnusedAnno) : "GLB of @Format(UNUSED) and @Format(GENERAL) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatUnusedAnno, FormatCharAnno), FormatUnusedAnno) : "GLB of @Format(UNUSED) and @Format(CHAR) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatUnusedAnno, FormatIntAnno), FormatUnusedAnno) : "GLB of @Format(UNUSED) and @Format(INT) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatUnusedAnno, FormatTimeAnno), FormatUnusedAnno) : "GLB of @Format(UNUSED) and @Format(TIME) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatUnusedAnno, FormatFloatAnno), FormatUnusedAnno) : "GLB of @Format(UNUSED) and @Format(FLOAT) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatUnusedAnno, FormatCharAndIntAnno), FormatUnusedAnno) : "GLB of @Format(UNUSED) and @Format(CHAR_AND_INT) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatUnusedAnno, FormatIntAndTimeAnno), FormatUnusedAnno) : "GLB of @Format(UNUSED) and @Format(INT_AND_TIME) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatUnusedAnno, FormatNullAnno), FormatUnusedAnno) : "GLB of @Format(UNUSED) and @Format(NULL) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatGeneralAnno, FormatUnusedAnno), FormatUnusedAnno) : "GLB of @Format(GENERAL) and @Format(UNUSED) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatGeneralAnno, FormatGeneralAnno), FormatGeneralAnno) : "GLB of @Format(GENERAL) and @Format(GENERAL) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatGeneralAnno, FormatCharAnno), FormatGeneralAnno) : "GLB of @Format(GENERAL) and @Format(CHAR) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatGeneralAnno, FormatIntAnno), FormatGeneralAnno) : "GLB of @Format(GENERAL) and @Format(INT) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatGeneralAnno, FormatTimeAnno), FormatGeneralAnno) : "GLB of @Format(GENERAL) and @Format(TIME) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatGeneralAnno, FormatFloatAnno), FormatGeneralAnno) : "GLB of @Format(GENERAL) and @Format(FLOAT) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatGeneralAnno, FormatCharAndIntAnno), FormatGeneralAnno) : "GLB of @Format(GENERAL) and @Format(CHAR_AND_INT) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatGeneralAnno, FormatIntAndTimeAnno), FormatGeneralAnno) : "GLB of @Format(GENERAL) and @Format(INT_AND_TIME) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatGeneralAnno, FormatNullAnno), FormatGeneralAnno) : "GLB of @Format(GENERAL) and @Format(NULL) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAnno, FormatUnusedAnno), FormatUnusedAnno) : "GLB of @Format(CHAR) and @Format(UNUSED) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAnno, FormatGeneralAnno), FormatGeneralAnno) : "GLB of @Format(CHAR) and @Format(GENERAL) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAnno, FormatCharAnno), FormatCharAnno) : "GLB of @Format(CHAR) and @Format(CHAR) is not @Format(CHAR)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAnno, FormatIntAnno), FormatGeneralAnno) : "GLB of @Format(CHAR) and @Format(INT) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAnno, FormatTimeAnno), FormatGeneralAnno) : "GLB of @Format(CHAR) and @Format(TIME) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAnno, FormatFloatAnno), FormatGeneralAnno) : "GLB of @Format(CHAR) and @Format(FLOAT) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAnno, FormatCharAndIntAnno), FormatCharAnno) : "GLB of @Format(CHAR) and @Format(CHAR_AND_INT) is not @Format(CHAR)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAnno, FormatIntAndTimeAnno), FormatGeneralAnno) : "GLB of @Format(CHAR) and @Format(INT_AND_TIME) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAnno, FormatNullAnno), FormatCharAnno) : "GLB of @Format(CHAR) and @Format(NULL) is not @Format(CHAR)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatIntAnno, FormatUnusedAnno), FormatUnusedAnno) : "GLB of @Format(INT) and @Format(UNUSED) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatIntAnno, FormatGeneralAnno), FormatGeneralAnno) : "GLB of @Format(INT) and @Format(GENERAL) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatIntAnno, FormatCharAnno), FormatGeneralAnno) : "GLB of @Format(INT) and @Format(CHAR) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatIntAnno, FormatIntAnno), FormatIntAnno) : "GLB of @Format(INT) and @Format(INT) is not @Format(INT)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatIntAnno, FormatTimeAnno), FormatGeneralAnno) : "GLB of @Format(INT) and @Format(TIME) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatIntAnno, FormatFloatAnno), FormatGeneralAnno) : "GLB of @Format(INT) and @Format(FLOAT) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatIntAnno, FormatCharAndIntAnno), FormatIntAnno) : "GLB of @Format(INT) and @Format(CHAR_AND_INT) is not @Format(INT)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatIntAnno, FormatIntAndTimeAnno), FormatIntAnno) : "GLB of @Format(INT) and @Format(INT_AND_TIME) is not @Format(INT)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatIntAnno, FormatNullAnno), FormatIntAnno) : "GLB of @Format(INT) and @Format(NULL) is not @Format(INT)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatTimeAnno, FormatUnusedAnno), FormatUnusedAnno) : "GLB of @Format(TIME) and @Format(UNUSED) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatTimeAnno, FormatGeneralAnno), FormatGeneralAnno) : "GLB of @Format(TIME) and @Format(GENERAL) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatTimeAnno, FormatCharAnno), FormatGeneralAnno) : "GLB of @Format(TIME) and @Format(CHAR) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatTimeAnno, FormatIntAnno), FormatGeneralAnno) : "GLB of @Format(TIME) and @Format(INT) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatTimeAnno, FormatTimeAnno), FormatTimeAnno) : "GLB of @Format(TIME) and @Format(TIME) is not @Format(TIME)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatTimeAnno, FormatFloatAnno), FormatGeneralAnno) : "GLB of @Format(TIME) and @Format(FLOAT) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatTimeAnno, FormatCharAndIntAnno), FormatGeneralAnno) : "GLB of @Format(TIME) and @Format(CHAR_AND_INT) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatTimeAnno, FormatIntAndTimeAnno), FormatTimeAnno) : "GLB of @Format(TIME) and @Format(INT_AND_TIME) is not @Format(TIME)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatTimeAnno, FormatNullAnno), FormatTimeAnno) : "GLB of @Format(TIME) and @Format(NULL) is not @Format(TIME)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatFloatAnno, FormatUnusedAnno), FormatUnusedAnno) : "GLB of @Format(FLOAT) and @Format(UNUSED) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatFloatAnno, FormatGeneralAnno), FormatGeneralAnno) : "GLB of @Format(FLOAT) and @Format(GENERAL) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatFloatAnno, FormatCharAnno), FormatGeneralAnno) : "GLB of @Format(FLOAT) and @Format(CHAR) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatFloatAnno, FormatIntAnno), FormatGeneralAnno) : "GLB of @Format(FLOAT) and @Format(INT) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatFloatAnno, FormatTimeAnno), FormatGeneralAnno) : "GLB of @Format(FLOAT) and @Format(TIME) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatFloatAnno, FormatFloatAnno), FormatFloatAnno) : "GLB of @Format(FLOAT) and @Format(FLOAT) is not @Format(FLOAT)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatFloatAnno, FormatCharAndIntAnno), FormatGeneralAnno) : "GLB of @Format(FLOAT) and @Format(CHAR_AND_INT) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatFloatAnno, FormatIntAndTimeAnno), FormatGeneralAnno) : "GLB of @Format(FLOAT) and @Format(INT_AND_TIME) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatFloatAnno, FormatNullAnno), FormatFloatAnno) : "GLB of @Format(FLOAT) and @Format(NULL) is not @Format(FLOAT)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAndIntAnno, FormatUnusedAnno), FormatUnusedAnno) : "GLB of @Format(CHAR_AND_INT) and @Format(UNUSED) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAndIntAnno, FormatGeneralAnno), FormatGeneralAnno) : "GLB of @Format(CHAR_AND_INT) and @Format(GENERAL) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAndIntAnno, FormatCharAnno), FormatCharAnno) : "GLB of @Format(CHAR_AND_INT) and @Format(CHAR) is not @Format(CHAR)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAndIntAnno, FormatIntAnno), FormatIntAnno) : "GLB of @Format(CHAR_AND_INT) and @Format(INT) is not @Format(INT)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAndIntAnno, FormatTimeAnno), FormatGeneralAnno) : "GLB of @Format(CHAR_AND_INT) and @Format(TIME) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAndIntAnno, FormatFloatAnno), FormatGeneralAnno) : "GLB of @Format(CHAR_AND_INT) and @Format(FLOAT) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAndIntAnno, FormatCharAndIntAnno), FormatCharAndIntAnno) : "GLB of @Format(CHAR_AND_INT) and @Format(CHAR_AND_INT) is not @Format(CHAR_AND_INT)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAndIntAnno, FormatIntAndTimeAnno), FormatIntAnno) : "GLB of @Format(CHAR_AND_INT) and @Format(INT_AND_TIME) is not @Format(INT)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatCharAndIntAnno, FormatNullAnno), FormatCharAndIntAnno) : "GLB of @Format(CHAR_AND_INT) and @Format(NULL) is not @Format(CHAR_AND_INT)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatIntAndTimeAnno, FormatUnusedAnno), FormatUnusedAnno) : "GLB of @Format(INT_AND_TIME) and @Format(UNUSED) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatIntAndTimeAnno, FormatGeneralAnno), FormatGeneralAnno) : "GLB of @Format(INT_AND_TIME) and @Format(GENERAL) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatIntAndTimeAnno, FormatCharAnno), FormatGeneralAnno) : "GLB of @Format(INT_AND_TIME) and @Format(CHAR) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatIntAndTimeAnno, FormatIntAnno), FormatIntAnno) : "GLB of @Format(INT_AND_TIME) and @Format(INT) is not @Format(INT)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatIntAndTimeAnno, FormatTimeAnno), FormatTimeAnno) : "GLB of @Format(INT_AND_TIME) and @Format(TIME) is not @Format(TIME)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatIntAndTimeAnno, FormatFloatAnno), FormatGeneralAnno) : "GLB of @Format(INT_AND_TIME) and @Format(FLOAT) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatIntAndTimeAnno, FormatCharAndIntAnno), FormatIntAnno) : "GLB of @Format(INT_AND_TIME) and @Format(CHAR_AND_INT) is not @Format(INT)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatIntAndTimeAnno, FormatIntAndTimeAnno), FormatIntAndTimeAnno) : "GLB of @Format(INT_AND_TIME) and @Format(INT_AND_TIME) is not @Format(INT_AND_TIME)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatIntAndTimeAnno, FormatNullAnno), FormatIntAndTimeAnno) : "GLB of @Format(INT_AND_TIME) and @Format(NULL) is not @Format(INT_AND_TIME)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatNullAnno, FormatUnusedAnno), FormatUnusedAnno) : "GLB of @Format(NULL) and @Format(UNUSED) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatNullAnno, FormatGeneralAnno), FormatGeneralAnno) : "GLB of @Format(NULL) and @Format(GENERAL) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatNullAnno, FormatCharAnno), FormatCharAnno) : "GLB of @Format(NULL) and @Format(CHAR) is not @Format(CHAR)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatNullAnno, FormatIntAnno), FormatIntAnno) : "GLB of @Format(NULL) and @Format(INT) is not @Format(INT)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatNullAnno, FormatTimeAnno), FormatTimeAnno) : "GLB of @Format(NULL) and @Format(TIME) is not @Format(TIME)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatNullAnno, FormatFloatAnno), FormatFloatAnno) : "GLB of @Format(NULL) and @Format(FLOAT) is not @Format(FLOAT)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatNullAnno, FormatCharAndIntAnno), FormatCharAndIntAnno) : "GLB of @Format(NULL) and @Format(CHAR_AND_INT) is not @Format(CHAR_AND_INT)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatNullAnno, FormatIntAndTimeAnno), FormatIntAndTimeAnno) : "GLB of @Format(NULL) and @Format(INT_AND_TIME) is not @Format(INT_AND_TIME)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatNullAnno, FormatNullAnno), FormatNullAnno) : "GLB of @Format(NULL) and @Format(NULL) is not @Format(NULL)!";
    // Now test with two ConversionCategory at a time:
    ConversionCategory[] cc2 = new ConversionCategory[2];
    cc2[0] = ConversionCategory.CHAR_AND_INT;
    cc2[1] = ConversionCategory.FLOAT;
    AnnotationMirror FormatTwoConvCat1 = treeUtil.categoriesToFormatAnnotation(cc2);
    cc2[0] = ConversionCategory.INT;
    cc2[1] = ConversionCategory.CHAR;
    AnnotationMirror FormatTwoConvCat2 = treeUtil.categoriesToFormatAnnotation(cc2);
    cc2[0] = ConversionCategory.INT;
    cc2[1] = ConversionCategory.GENERAL;
    AnnotationMirror FormatTwoConvCat3 = treeUtil.categoriesToFormatAnnotation(cc2);
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatTwoConvCat1, FormatTwoConvCat2), FormatTwoConvCat3) : "GLB of @Format([CHAR_AND_INT,FLOAT]) and @Format([INT,CHAR]) is not @Format([INT,GENERAL])!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatGeneralAnno, FormatTwoConvCat1), FormatGeneralAnno) : "GLB of @I18nFormat(GENERAL) and @I18nFormat([CHAR_AND_INT,FLOAT]) is not @I18nFormat(GENERAL)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatTwoConvCat2, FormatNullAnno), FormatIntAnno) : "GLB of @I18nFormat([INT,CHAR]) and @I18nFormat(NULL) is not @I18nFormat(INT)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(UNKNOWNFORMAT, UNKNOWNFORMAT), UNKNOWNFORMAT) : "GLB of @UnknownFormat and @UnknownFormat is not @UnknownFormat!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(UNKNOWNFORMAT, FORMAT), FORMAT) : "GLB of @UnknownFormat and @Format(null) is not @Format(null)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(UNKNOWNFORMAT, FormatUnusedAnno), FormatUnusedAnno) : "GLB of @UnknownFormat and @Format(UNUSED) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(UNKNOWNFORMAT, INVALIDFORMAT), INVALIDFORMAT) : "GLB of @UnknownFormat and @InvalidFormat(null) is not @InvalidFormat(null)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(UNKNOWNFORMAT, InvalidFormatWithMessage), InvalidFormatWithMessage) : "GLB of @UnknownFormat and @InvalidFormat(\"Message\") is not @InvalidFormat(\"Message\")!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(UNKNOWNFORMAT, FORMATBOTTOM), FORMATBOTTOM) : "GLB of @UnknownFormat and @FormatBottom is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FORMAT, UNKNOWNFORMAT), FORMAT) : "GLB of @Format(null) and @UnknownFormat is not @Format(null)!";
    // practice. Skipping this case as it causes an expected crash.
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FORMAT, INVALIDFORMAT), FORMATBOTTOM) : "GLB of @Format(null) and @InvalidFormat(null) is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FORMAT, InvalidFormatWithMessage), FORMATBOTTOM) : "GLB of @Format(null) and @InvalidFormat(\"Message\") is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FORMAT, FORMATBOTTOM), FORMATBOTTOM) : "GLB of @Format(null) and @FormatBottom is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatUnusedAnno, UNKNOWNFORMAT), FormatUnusedAnno) : "GLB of @Format(UNUSED) and @UnknownFormat is not @Format(UNUSED)!";
    // practice. Skipping this case as it causes an expected crash.
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatUnusedAnno, FormatUnusedAnno), FormatUnusedAnno) : "GLB of @Format(UNUSED) and @Format(UNUSED) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatUnusedAnno, INVALIDFORMAT), FORMATBOTTOM) : "GLB of @Format(UNUSED) and @InvalidFormat(null) is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatUnusedAnno, InvalidFormatWithMessage), FORMATBOTTOM) : "GLB of @Format(UNUSED) and @InvalidFormat(\"Message\") is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FormatUnusedAnno, FORMATBOTTOM), FORMATBOTTOM) : "GLB of @Format(UNUSED) and @FormatBottom is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(INVALIDFORMAT, UNKNOWNFORMAT), INVALIDFORMAT) : "GLB of @InvalidFormat(null) and @UnknownFormat is not @InvalidFormat(null)!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(INVALIDFORMAT, FORMAT), FORMATBOTTOM) : "GLB of @InvalidFormat(null) and @Format(null) is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(INVALIDFORMAT, FormatUnusedAnno), FORMATBOTTOM) : "GLB of @InvalidFormat(null) and @Format(UNUSED) is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(INVALIDFORMAT, FORMATBOTTOM), FORMATBOTTOM) : "GLB of @InvalidFormat(null) and @FormatBottom is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(InvalidFormatWithMessage, UNKNOWNFORMAT), InvalidFormatWithMessage) : "GLB of @InvalidFormat(\"Message\") and @UnknownFormat is not @InvalidFormat(\"Message\")!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(InvalidFormatWithMessage, FORMAT), FORMATBOTTOM) : "GLB of @InvalidFormat(\"Message\") and @Format(null) is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(InvalidFormatWithMessage, FormatUnusedAnno), FORMATBOTTOM) : "GLB of @InvalidFormat(\"Message\") and @Format(UNUSED) is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(InvalidFormatWithMessage, InvalidFormatWithMessage), InvalidFormatWithMessage) : "GLB of @InvalidFormat(\"Message\") and @InvalidFormat(\"Message\") is not @InvalidFormat(\"Message\")!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(InvalidFormatWithMessage, InvalidFormatWithMessage2), InvalidFormatWithMessagesAnded) : "GLB of @InvalidFormat(\"Message\") and @InvalidFormat(\"Message2\") is not @InvalidFormat(\"(\"Message\" and \"Message2\")\")!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(InvalidFormatWithMessage, FORMATBOTTOM), FORMATBOTTOM) : "GLB of @InvalidFormat(\"Message\") and @FormatBottom is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FORMATBOTTOM, UNKNOWNFORMAT), FORMATBOTTOM) : "GLB of @FormatBottom and @UnknownFormat is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FORMATBOTTOM, FORMAT), FORMATBOTTOM) : "GLB of @FormatBottom and @Format(null) is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FORMATBOTTOM, FormatUnusedAnno), FORMATBOTTOM) : "GLB of @FormatBottom and @Format(UNUSED) is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FORMATBOTTOM, INVALIDFORMAT), FORMATBOTTOM) : "GLB of @FormatBottom and @InvalidFormat(null) is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FORMATBOTTOM, InvalidFormatWithMessage), FORMATBOTTOM) : "GLB of @FormatBottom and @InvalidFormat(\"Message\") is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.greatestLowerBound(FORMATBOTTOM, FORMATBOTTOM), FORMATBOTTOM) : "GLB of @FormatBottom and @FormatBottom is not @FormatBottom!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatUnusedAnno, FormatUnusedAnno), FormatUnusedAnno) : "LUB of @Format(UNUSED) and @Format(UNUSED) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatUnusedAnno, FormatGeneralAnno), FormatGeneralAnno) : "LUB of @Format(UNUSED) and @Format(GENERAL) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatUnusedAnno, FormatCharAnno), FormatCharAnno) : "LUB of @Format(UNUSED) and @Format(CHAR) is not @Format(CHAR)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatUnusedAnno, FormatIntAnno), FormatIntAnno) : "LUB of @Format(UNUSED) and @Format(INT) is not @Format(INT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatUnusedAnno, FormatTimeAnno), FormatTimeAnno) : "LUB of @Format(UNUSED) and @Format(TIME) is not @Format(TIME)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatUnusedAnno, FormatFloatAnno), FormatFloatAnno) : "LUB of @Format(UNUSED) and @Format(FLOAT) is not @Format(FLOAT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatUnusedAnno, FormatCharAndIntAnno), FormatCharAndIntAnno) : "LUB of @Format(UNUSED) and @Format(CHAR_AND_INT) is not @Format(CHAR_AND_INT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatUnusedAnno, FormatIntAndTimeAnno), FormatIntAndTimeAnno) : "LUB of @Format(UNUSED) and @Format(INT_AND_TIME) is not @Format(INT_AND_TIME)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatUnusedAnno, FormatNullAnno), FormatNullAnno) : "LUB of @Format(UNUSED) and @Format(NULL) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatGeneralAnno, FormatUnusedAnno), FormatGeneralAnno) : "LUB of @Format(GENERAL) and @Format(UNUSED) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatGeneralAnno, FormatGeneralAnno), FormatGeneralAnno) : "LUB of @Format(GENERAL) and @Format(GENERAL) is not @Format(GENERAL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatGeneralAnno, FormatCharAnno), FormatCharAnno) : "LUB of @Format(GENERAL) and @Format(CHAR) is not @Format(CHAR)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatGeneralAnno, FormatIntAnno), FormatIntAnno) : "LUB of @Format(GENERAL) and @Format(INT) is not @Format(INT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatGeneralAnno, FormatTimeAnno), FormatTimeAnno) : "LUB of @Format(GENERAL) and @Format(TIME) is not @Format(TIME)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatGeneralAnno, FormatFloatAnno), FormatFloatAnno) : "LUB of @Format(GENERAL) and @Format(FLOAT) is not @Format(FLOAT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatGeneralAnno, FormatCharAndIntAnno), FormatCharAndIntAnno) : "LUB of @Format(GENERAL) and @Format(CHAR_AND_INT) is not @Format(CHAR_AND_INT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatGeneralAnno, FormatIntAndTimeAnno), FormatIntAndTimeAnno) : "LUB of @Format(GENERAL) and @Format(INT_AND_TIME) is not @Format(INT_AND_TIME)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatGeneralAnno, FormatNullAnno), FormatNullAnno) : "LUB of @Format(GENERAL) and @Format(NULL) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatCharAnno, FormatUnusedAnno), FormatCharAnno) : "LUB of @Format(CHAR) and @Format(UNUSED) is not @Format(CHAR)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatCharAnno, FormatGeneralAnno), FormatCharAnno) : "LUB of @Format(CHAR) and @Format(GENERAL) is not @Format(CHAR)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatCharAnno, FormatCharAnno), FormatCharAnno) : "LUB of @Format(CHAR) and @Format(CHAR) is not @Format(CHAR)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatCharAnno, FormatIntAnno), FormatCharAndIntAnno) : "LUB of @Format(CHAR) and @Format(INT) is not @Format(CHAR_AND_INT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatCharAnno, FormatTimeAnno), FormatNullAnno) : "LUB of @Format(CHAR) and @Format(TIME) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatCharAnno, FormatFloatAnno), FormatNullAnno) : "LUB of @Format(CHAR) and @Format(FLOAT) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatCharAnno, FormatCharAndIntAnno), FormatCharAndIntAnno) : "LUB of @Format(CHAR) and @Format(CHAR_AND_INT) is not @Format(CHAR_AND_INT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatCharAnno, FormatIntAndTimeAnno), FormatNullAnno) : "LUB of @Format(CHAR) and @Format(INT_AND_TIME) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatCharAnno, FormatNullAnno), FormatNullAnno) : "LUB of @Format(CHAR) and @Format(NULL) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatIntAnno, FormatUnusedAnno), FormatIntAnno) : "LUB of @Format(INT) and @Format(UNUSED) is not @Format(INT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatIntAnno, FormatGeneralAnno), FormatIntAnno) : "LUB of @Format(INT) and @Format(GENERAL) is not @Format(INT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatIntAnno, FormatCharAnno), FormatCharAndIntAnno) : "LUB of @Format(INT) and @Format(CHAR) is not @Format(CHAR_AND_INT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatIntAnno, FormatIntAnno), FormatIntAnno) : "LUB of @Format(INT) and @Format(INT) is not @Format(INT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatIntAnno, FormatTimeAnno), FormatIntAndTimeAnno) : "LUB of @Format(INT) and @Format(TIME) is not @Format(INT_AND_TIME)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatIntAnno, FormatFloatAnno), FormatNullAnno) : "LUB of @Format(INT) and @Format(FLOAT) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatIntAnno, FormatCharAndIntAnno), FormatCharAndIntAnno) : "LUB of @Format(INT) and @Format(CHAR_AND_INT) is not @Format(CHAR_AND_INT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatIntAnno, FormatIntAndTimeAnno), FormatIntAndTimeAnno) : "LUB of @Format(INT) and @Format(INT_AND_TIME) is not @Format(INT_AND_TIME)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatIntAnno, FormatNullAnno), FormatNullAnno) : "LUB of @Format(INT) and @Format(NULL) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatTimeAnno, FormatUnusedAnno), FormatTimeAnno) : "LUB of @Format(TIME) and @Format(UNUSED) is not @Format(TIME)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatTimeAnno, FormatGeneralAnno), FormatTimeAnno) : "LUB of @Format(TIME) and @Format(GENERAL) is not @Format(TIME)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatTimeAnno, FormatCharAnno), FormatNullAnno) : "LUB of @Format(TIME) and @Format(CHAR) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatTimeAnno, FormatIntAnno), FormatIntAndTimeAnno) : "LUB of @Format(TIME) and @Format(INT) is not @Format(INT_AND_TIME)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatTimeAnno, FormatTimeAnno), FormatTimeAnno) : "LUB of @Format(TIME) and @Format(TIME) is not @Format(TIME)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatTimeAnno, FormatFloatAnno), FormatNullAnno) : "LUB of @Format(TIME) and @Format(FLOAT) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatTimeAnno, FormatCharAndIntAnno), FormatNullAnno) : "LUB of @Format(TIME) and @Format(CHAR_AND_INT) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatTimeAnno, FormatIntAndTimeAnno), FormatIntAndTimeAnno) : "LUB of @Format(TIME) and @Format(INT_AND_TIME) is not @Format(INT_AND_TIME)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatTimeAnno, FormatNullAnno), FormatNullAnno) : "LUB of @Format(TIME) and @Format(NULL) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatFloatAnno, FormatUnusedAnno), FormatFloatAnno) : "LUB of @Format(FLOAT) and @Format(UNUSED) is not @Format(FLOAT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatFloatAnno, FormatGeneralAnno), FormatFloatAnno) : "LUB of @Format(FLOAT) and @Format(GENERAL) is not @Format(FLOAT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatFloatAnno, FormatCharAnno), FormatNullAnno) : "LUB of @Format(FLOAT) and @Format(CHAR) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatFloatAnno, FormatIntAnno), FormatNullAnno) : "LUB of @Format(FLOAT) and @Format(INT) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatFloatAnno, FormatTimeAnno), FormatNullAnno) : "LUB of @Format(FLOAT) and @Format(TIME) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatFloatAnno, FormatFloatAnno), FormatFloatAnno) : "LUB of @Format(FLOAT) and @Format(FLOAT) is not @Format(FLOAT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatFloatAnno, FormatCharAndIntAnno), FormatNullAnno) : "LUB of @Format(FLOAT) and @Format(CHAR_AND_INT) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatFloatAnno, FormatIntAndTimeAnno), FormatNullAnno) : "LUB of @Format(FLOAT) and @Format(INT_AND_TIME) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatFloatAnno, FormatNullAnno), FormatNullAnno) : "LUB of @Format(FLOAT) and @Format(NULL) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatCharAndIntAnno, FormatUnusedAnno), FormatCharAndIntAnno) : "LUB of @Format(CHAR_AND_INT) and @Format(UNUSED) is not @Format(CHAR_AND_INT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatCharAndIntAnno, FormatGeneralAnno), FormatCharAndIntAnno) : "LUB of @Format(CHAR_AND_INT) and @Format(GENERAL) is not @Format(CHAR_AND_INT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatCharAndIntAnno, FormatCharAnno), FormatCharAndIntAnno) : "LUB of @Format(CHAR_AND_INT) and @Format(CHAR) is not @Format(CHAR_AND_INT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatCharAndIntAnno, FormatIntAnno), FormatCharAndIntAnno) : "LUB of @Format(CHAR_AND_INT) and @Format(INT) is not @Format(CHAR_AND_INT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatCharAndIntAnno, FormatTimeAnno), FormatNullAnno) : "LUB of @Format(CHAR_AND_INT) and @Format(TIME) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatCharAndIntAnno, FormatFloatAnno), FormatNullAnno) : "LUB of @Format(CHAR_AND_INT) and @Format(FLOAT) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatCharAndIntAnno, FormatCharAndIntAnno), FormatCharAndIntAnno) : "LUB of @Format(CHAR_AND_INT) and @Format(CHAR_AND_INT) is not @Format(CHAR_AND_INT)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatCharAndIntAnno, FormatIntAndTimeAnno), FormatNullAnno) : "LUB of @Format(CHAR_AND_INT) and @Format(INT_AND_TIME) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatCharAndIntAnno, FormatNullAnno), FormatNullAnno) : "LUB of @Format(CHAR_AND_INT) and @Format(NULL) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatIntAndTimeAnno, FormatUnusedAnno), FormatIntAndTimeAnno) : "LUB of @Format(INT_AND_TIME) and @Format(UNUSED) is not @Format(INT_AND_TIME)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatIntAndTimeAnno, FormatGeneralAnno), FormatIntAndTimeAnno) : "LUB of @Format(INT_AND_TIME) and @Format(GENERAL) is not @Format(INT_AND_TIME)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatIntAndTimeAnno, FormatCharAnno), FormatNullAnno) : "LUB of @Format(INT_AND_TIME) and @Format(CHAR) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatIntAndTimeAnno, FormatIntAnno), FormatIntAndTimeAnno) : "LUB of @Format(INT_AND_TIME) and @Format(INT) is not @Format(INT_AND_TIME)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatIntAndTimeAnno, FormatTimeAnno), FormatIntAndTimeAnno) : "LUB of @Format(INT_AND_TIME) and @Format(TIME) is not @Format(INT_AND_TIME)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatIntAndTimeAnno, FormatFloatAnno), FormatNullAnno) : "LUB of @Format(INT_AND_TIME) and @Format(FLOAT) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatIntAndTimeAnno, FormatCharAndIntAnno), FormatNullAnno) : "LUB of @Format(INT_AND_TIME) and @Format(CHAR_AND_INT) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatIntAndTimeAnno, FormatIntAndTimeAnno), FormatIntAndTimeAnno) : "LUB of @Format(INT_AND_TIME) and @Format(INT_AND_TIME) is not @Format(INT_AND_TIME)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatIntAndTimeAnno, FormatNullAnno), FormatNullAnno) : "LUB of @Format(INT_AND_TIME) and @Format(NULL) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatNullAnno, FormatUnusedAnno), FormatNullAnno) : "LUB of @Format(NULL) and @Format(UNUSED) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatNullAnno, FormatGeneralAnno), FormatNullAnno) : "LUB of @Format(NULL) and @Format(GENERAL) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatNullAnno, FormatCharAnno), FormatNullAnno) : "LUB of @Format(NULL) and @Format(CHAR) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatNullAnno, FormatIntAnno), FormatNullAnno) : "LUB of @Format(NULL) and @Format(INT) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatNullAnno, FormatTimeAnno), FormatNullAnno) : "LUB of @Format(NULL) and @Format(TIME) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatNullAnno, FormatFloatAnno), FormatNullAnno) : "LUB of @Format(NULL) and @Format(FLOAT) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatNullAnno, FormatCharAndIntAnno), FormatNullAnno) : "LUB of @Format(NULL) and @Format(CHAR_AND_INT) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatNullAnno, FormatIntAndTimeAnno), FormatNullAnno) : "LUB of @Format(NULL) and @Format(INT_AND_TIME) is not @Format(NULL)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatNullAnno, FormatNullAnno), FormatNullAnno) : "LUB of @Format(NULL) and @Format(NULL) is not @Format(NULL)!";
    // Now test with two ConversionCategory at a time:
    cc2[0] = ConversionCategory.CHAR_AND_INT;
    cc2[1] = ConversionCategory.NULL;
    AnnotationMirror FormatTwoConvCat4 = treeUtil.categoriesToFormatAnnotation(cc2);
    cc2[0] = ConversionCategory.NULL;
    cc2[1] = ConversionCategory.CHAR;
    AnnotationMirror FormatTwoConvCat5 = treeUtil.categoriesToFormatAnnotation(cc2);
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatTwoConvCat1, FormatTwoConvCat2), FormatTwoConvCat4) : "LUB of @Format([CHAR_AND_INT,FLOAT]) and @Format([INT,CHAR]) is not @Format([CHAR_AND_INT,NULL])!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatGeneralAnno, FormatTwoConvCat1), FormatTwoConvCat1) : "LUB of @I18nFormat(GENERAL) and @I18nFormat([CHAR_AND_INT,FLOAT]) is not @I18nFormat([CHAR_AND_INT,FLOAT])!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatTwoConvCat2, FormatNullAnno), FormatTwoConvCat5) : "LUB of @I18nFormat([INT,CHAR]) and @I18nFormat(NULL) is not @I18nFormat([NULL,CHAR])!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(UNKNOWNFORMAT, UNKNOWNFORMAT), UNKNOWNFORMAT) : "LUB of @UnknownFormat and @UnknownFormat is not @UnknownFormat!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(UNKNOWNFORMAT, FORMAT), UNKNOWNFORMAT) : "LUB of @UnknownFormat and @Format(null) is not @UnknownFormat!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(UNKNOWNFORMAT, FormatUnusedAnno), UNKNOWNFORMAT) : "LUB of @UnknownFormat and @Format(UNUSED) is not @UnknownFormat!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(UNKNOWNFORMAT, INVALIDFORMAT), UNKNOWNFORMAT) : "LUB of @UnknownFormat and @InvalidFormat(null) is not @UnknownFormat!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(UNKNOWNFORMAT, InvalidFormatWithMessage), UNKNOWNFORMAT) : "LUB of @UnknownFormat and @InvalidFormat(\"Message\") is not @UnknownFormat!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(UNKNOWNFORMAT, FORMATBOTTOM), UNKNOWNFORMAT) : "LUB of @UnknownFormat and @FormatBottom is not @UnknownFormat!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FORMAT, UNKNOWNFORMAT), UNKNOWNFORMAT) : "LUB of @Format(null) and @UnknownFormat is not @UnknownFormat!";
    // practice. Skipping this case as it causes an expected crash.
    assert AnnotationUtils.areSame(qh.leastUpperBound(FORMAT, INVALIDFORMAT), UNKNOWNFORMAT) : "LUB of @Format(null) and @InvalidFormat(null) is not @UnknownFormat!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FORMAT, InvalidFormatWithMessage), UNKNOWNFORMAT) : "LUB of @Format(null) and @InvalidFormat(\"Message\") is not @UnknownFormat!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FORMAT, FORMATBOTTOM), FORMAT) : "LUB of @Format(null) and @FormatBottom is not @Format(null)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatUnusedAnno, UNKNOWNFORMAT), UNKNOWNFORMAT) : "LUB of @Format(UNUSED) and @UnknownFormat is not @UnknownFormat!";
    // practice. Skipping this case as it causes an expected crash.
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatUnusedAnno, FormatUnusedAnno), FormatUnusedAnno) : "LUB of @Format(UNUSED) and @Format(UNUSED) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatUnusedAnno, INVALIDFORMAT), UNKNOWNFORMAT) : "LUB of @Format(UNUSED) and @InvalidFormat(null) is not @UnknownFormat!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatUnusedAnno, InvalidFormatWithMessage), UNKNOWNFORMAT) : "LUB of @Format(UNUSED) and @InvalidFormat(\"Message\") is not @UnknownFormat!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FormatUnusedAnno, FORMATBOTTOM), FormatUnusedAnno) : "LUB of @Format(UNUSED) and @FormatBottom is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(INVALIDFORMAT, UNKNOWNFORMAT), UNKNOWNFORMAT) : "LUB of @InvalidFormat(null) and @UnknownFormat is not @UnknownFormat!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(INVALIDFORMAT, FORMAT), UNKNOWNFORMAT) : "LUB of @InvalidFormat(null) and @Format(null) is not @UnknownFormat!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(INVALIDFORMAT, FormatUnusedAnno), UNKNOWNFORMAT) : "LUB of @InvalidFormat(null) and @Format(UNUSED) is not @UnknownFormat!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(INVALIDFORMAT, FORMATBOTTOM), INVALIDFORMAT) : "LUB of @InvalidFormat(null) and @FormatBottom is not @InvalidFormat(null)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(InvalidFormatWithMessage, UNKNOWNFORMAT), UNKNOWNFORMAT) : "LUB of @InvalidFormat(\"Message\") and @UnknownFormat is not @UnknownFormat!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(InvalidFormatWithMessage, FORMAT), UNKNOWNFORMAT) : "LUB of @InvalidFormat(\"Message\") and @Format(null) is not @UnknownFormat!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(InvalidFormatWithMessage, FormatUnusedAnno), UNKNOWNFORMAT) : "LUB of @InvalidFormat(\"Message\") and @Format(UNUSED) is not @UnknownFormat!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(InvalidFormatWithMessage, InvalidFormatWithMessage), InvalidFormatWithMessage) : "LUB of @InvalidFormat(\"Message\") and @InvalidFormat(\"Message\") is not @InvalidFormat(\"Message\")!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(InvalidFormatWithMessage, InvalidFormatWithMessage2), InvalidFormatWithMessagesOred) : "LUB of @InvalidFormat(\"Message\") and @InvalidFormat(\"Message2\") is not @InvalidFormat(\"(\"Message\" or \"Message2\")\")!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(InvalidFormatWithMessage, FORMATBOTTOM), InvalidFormatWithMessage) : "LUB of @InvalidFormat(\"Message\") and @FormatBottom is not @InvalidFormat(\"Message\")!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FORMATBOTTOM, UNKNOWNFORMAT), UNKNOWNFORMAT) : "LUB of @FormatBottom and @UnknownFormat is not @UnknownFormat!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FORMATBOTTOM, FORMAT), FORMAT) : "LUB of @FormatBottom and @Format(null) is not @Format(null)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FORMATBOTTOM, FormatUnusedAnno), FormatUnusedAnno) : "LUB of @FormatBottom and @Format(UNUSED) is not @Format(UNUSED)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FORMATBOTTOM, INVALIDFORMAT), INVALIDFORMAT) : "LUB of @FormatBottom and @InvalidFormat(null) is not @InvalidFormat(null)!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FORMATBOTTOM, InvalidFormatWithMessage), InvalidFormatWithMessage) : "LUB of @FormatBottom and @InvalidFormat(\"Message\") is not @InvalidFormat(\"Message\")!";
    assert AnnotationUtils.areSame(qh.leastUpperBound(FORMATBOTTOM, FORMATBOTTOM), FORMATBOTTOM) : "LUB of @FormatBottom and @FormatBottom is not @FormatBottom!";
}
Also used : InvalidFormat(org.checkerframework.checker.formatter.qual.InvalidFormat) AnnotationMirror(javax.lang.model.element.AnnotationMirror) FormatterTreeUtil(org.checkerframework.checker.formatter.FormatterTreeUtil) ConversionCategory(org.checkerframework.checker.formatter.qual.ConversionCategory) AnnotationBuilder(org.checkerframework.javacutil.AnnotationBuilder) QualifierHierarchy(org.checkerframework.framework.type.QualifierHierarchy) Elements(javax.lang.model.util.Elements)

Example 27 with AnnotationBuilder

use of org.checkerframework.javacutil.AnnotationBuilder 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!";
}
Also used : AnnotationMirror(javax.lang.model.element.AnnotationMirror) AnnotationBuilder(org.checkerframework.javacutil.AnnotationBuilder) I18nInvalidFormat(org.checkerframework.checker.i18nformatter.qual.I18nInvalidFormat) QualifierHierarchy(org.checkerframework.framework.type.QualifierHierarchy) I18nFormatterTreeUtil(org.checkerframework.checker.i18nformatter.I18nFormatterTreeUtil) Elements(javax.lang.model.util.Elements) I18nConversionCategory(org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory)

Example 28 with AnnotationBuilder

use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.

the class UpperBoundAnnotatedTypeFactory method createLTLengthOfAnnotation.

AnnotationMirror createLTLengthOfAnnotation(String... names) {
    AnnotationBuilder builder = new AnnotationBuilder(getProcessingEnv(), LTLengthOf.class);
    if (names == null) {
        names = new String[0];
    }
    builder.setValue("value", names);
    return builder.build();
}
Also used : AnnotationBuilder(org.checkerframework.javacutil.AnnotationBuilder)

Example 29 with AnnotationBuilder

use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.

the class UpperBoundAnnotatedTypeFactory method createLTEqLengthOfAnnotation.

AnnotationMirror createLTEqLengthOfAnnotation(String... names) {
    AnnotationBuilder builder = new AnnotationBuilder(getProcessingEnv(), LTEqLengthOf.class);
    if (names == null) {
        names = new String[0];
    }
    builder.setValue("value", names);
    return builder.build();
}
Also used : AnnotationBuilder(org.checkerframework.javacutil.AnnotationBuilder)

Example 30 with AnnotationBuilder

use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.

the class InitializationAnnotatedTypeFactory method createUnclassifiedAnnotation.

/**
 * Returns a {@link UnknownInitialization} or {@link Raw} annotation with a given type frame.
 */
public AnnotationMirror createUnclassifiedAnnotation(Class<?> typeFrame) {
    assert typeFrame != null;
    Class<? extends Annotation> clazz = useFbc ? UnknownInitialization.class : Raw.class;
    AnnotationBuilder builder = new AnnotationBuilder(processingEnv, clazz);
    builder.setValue("value", typeFrame);
    return builder.build();
}
Also used : AnnotationBuilder(org.checkerframework.javacutil.AnnotationBuilder)

Aggregations

AnnotationBuilder (org.checkerframework.javacutil.AnnotationBuilder)63 Test (org.junit.Test)30 AnnotationMirror (javax.lang.model.element.AnnotationMirror)11 ArrayList (java.util.ArrayList)3 InvalidFormat (org.checkerframework.checker.formatter.qual.InvalidFormat)3 I18nInvalidFormat (org.checkerframework.checker.i18nformatter.qual.I18nInvalidFormat)3 HashSet (java.util.HashSet)2 LinkedHashSet (java.util.LinkedHashSet)2 Elements (javax.lang.model.util.Elements)2 Nullable (org.checkerframework.checker.nullness.qual.Nullable)2 QualifierHierarchy (org.checkerframework.framework.type.QualifierHierarchy)2 NodeList (com.github.javaparser.ast.NodeList)1 Expression (com.github.javaparser.ast.expr.Expression)1 MarkerAnnotationExpr (com.github.javaparser.ast.expr.MarkerAnnotationExpr)1 MemberValuePair (com.github.javaparser.ast.expr.MemberValuePair)1 NormalAnnotationExpr (com.github.javaparser.ast.expr.NormalAnnotationExpr)1 SingleMemberAnnotationExpr (com.github.javaparser.ast.expr.SingleMemberAnnotationExpr)1 Annotation (java.lang.annotation.Annotation)1 List (java.util.List)1 TypeElement (javax.lang.model.element.TypeElement)1