Search in sources :

Example 1 with RuntimeAnnotations_attribute

use of com.sun.tools.classfile.RuntimeAnnotations_attribute in project checker-framework by typetools.

the class ComparisionException method findAnnotations.

/**
 * Test the result of Attributes.getIndex according to expectations encoded in the method's
 * name.
 */
private static void findAnnotations(ClassFile cf, Method m, String name, List<Annotation> annos) {
    int index = m.attributes.getIndex(cf.constant_pool, name);
    if (index != -1) {
        Attribute attr = m.attributes.get(index);
        assert attr instanceof RuntimeAnnotations_attribute;
        RuntimeAnnotations_attribute tAttr = (RuntimeAnnotations_attribute) attr;
        for (Annotation an : tAttr.annotations) {
            if (!containsName(annos, an, cf)) {
                annos.add(an);
            }
        }
    }
}
Also used : Attribute(com.sun.tools.classfile.Attribute) RuntimeAnnotations_attribute(com.sun.tools.classfile.RuntimeAnnotations_attribute) Annotation(com.sun.tools.classfile.Annotation)

Example 2 with RuntimeAnnotations_attribute

use of com.sun.tools.classfile.RuntimeAnnotations_attribute in project checker-framework by typetools.

the class ComparisonException method findAnnotations.

/**
 * Test the result of Attributes.getIndex according to expectations encoded in the method's name.
 */
private static void findAnnotations(ClassFile cf, Method m, String name, List<Annotation> annos) {
    int index = m.attributes.getIndex(cf.constant_pool, name);
    if (index != -1) {
        Attribute attr = m.attributes.get(index);
        assert attr instanceof RuntimeAnnotations_attribute;
        RuntimeAnnotations_attribute tAttr = (RuntimeAnnotations_attribute) attr;
        for (Annotation an : tAttr.annotations) {
            if (!containsName(annos, an, cf)) {
                annos.add(an);
            }
        }
    }
}
Also used : Attribute(com.sun.tools.classfile.Attribute) RuntimeAnnotations_attribute(com.sun.tools.classfile.RuntimeAnnotations_attribute) Annotation(com.sun.tools.classfile.Annotation)

Aggregations

Annotation (com.sun.tools.classfile.Annotation)2 Attribute (com.sun.tools.classfile.Attribute)2 RuntimeAnnotations_attribute (com.sun.tools.classfile.RuntimeAnnotations_attribute)2