use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class I18nFormatterTreeUtil method categoriesToFormatAnnotation.
/**
* Takes a list of ConversionCategory elements, and returns a syntax tree element that
* represents a {@link I18nFormat} annotation with the list as value.
*/
public AnnotationMirror categoriesToFormatAnnotation(I18nConversionCategory[] args) {
AnnotationBuilder builder = new AnnotationBuilder(processingEnv, I18nFormat.class.getCanonicalName());
builder.setValue("value", args);
return builder.build();
}
use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class AnnotationBuilderTest method createAnnoWithoutValues.
@Test
public void createAnnoWithoutValues() {
AnnotationBuilder builder = new AnnotationBuilder(env, Encrypted.class);
// AnnotationMirror anno =
builder.build();
}
use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class AnnotationBuilderTest method addingValuesAfterBuilding.
@Test(expected = SourceChecker.CheckerError.class)
public void addingValuesAfterBuilding() {
AnnotationBuilder builder = new AnnotationBuilder(env, AnnoWithStringArg.class);
builder.setValue("value", "m");
// AnnotationMirror anno =
builder.build();
builder.setValue("value", "n");
}
use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class AnnotationBuilderTest method testToString4.
@Test
public void testToString4() {
AnnotationBuilder builder = new AnnotationBuilder(env, Anno.class);
builder.setValue("value", "m");
builder.setValue("can", new Object[] { 1 });
assertEquals("@tests.AnnotationBuilderTest.Anno(value=\"m\", can={1})", builder.build().toString());
}
use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class AnnotationBuilderTest method createAnnoWithValues0.
@Test
public void createAnnoWithValues0() {
AnnotationBuilder builder = new AnnotationBuilder(env, AnnoWithStringArg.class);
builder.setValue("value", "m");
AnnotationMirror anno = builder.build();
assertEquals(1, anno.getElementValues().size());
}
Aggregations