use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class AnnotationBuilderTest method buildingTwice.
@Test(expected = BugInCF.class)
public void buildingTwice() {
AnnotationBuilder builder = new AnnotationBuilder(env, Encrypted.class);
builder.build();
builder.build();
}
use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class KeyForAnnotatedTypeFactory method createKeyForAnnotationMirrorWithValue.
/**
* Given a string array 'values', returns an AnnotationMirror corresponding to @KeyFor(values)
*
* @param values the values for the {@code @KeyFor} annotation
* @return a {@code @KeyFor} annotation with the given values
*/
public AnnotationMirror createKeyForAnnotationMirrorWithValue(Set<String> values) {
// Create an AnnotationBuilder with the ArrayList
AnnotationBuilder builder = new AnnotationBuilder(getProcessingEnv(), KeyFor.class);
builder.setValue("value", values.toArray());
// Return the resulting AnnotationMirror
return builder.build();
}
use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class NullnessAnnotatedTypeFactory method requiresNonNullAnno.
/**
* Returns a {@code RequiresNonNull("...")} annotation for the given expression.
*
* @param expression an expression
* @return a {@code RequiresNonNull("...")} annotation for the given expression
*/
private AnnotationMirror requiresNonNullAnno(String expression) {
AnnotationBuilder builder = new AnnotationBuilder(processingEnv, RequiresNonNull.class);
builder.setValue("value", new String[] { expression });
AnnotationMirror am = builder.build();
return am;
}
use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class AnnotationBuilderTest method notFoundElements.
@Test(expected = BugInCF.class)
public void notFoundElements() {
AnnotationBuilder builder = new AnnotationBuilder(env, AnnoWithStringArg.class);
builder.setValue("n", "m");
}
use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class AnnotationBuilderTest method testEnumNegative.
@Test(expected = BugInCF.class)
public void testEnumNegative() {
AnnotationBuilder builder = new AnnotationBuilder(env, EnumElt.class);
builder.setValue("value", 2);
}
Aggregations