Search in sources :

Example 6 with Annotation

use of com.sun.tools.classfile.Annotation 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)

Example 7 with Annotation

use of com.sun.tools.classfile.Annotation in project jdk8u_jdk by JetBrains.

the class AnnotationsElementVisitor method visitRuntimeVisibleParameterAnnotations.

@Override
public Element visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute rvpa, Element p) {
    Element e = new Element(x.getCpString(rvpa.attribute_name_index));
    for (Annotation[] pa : rvpa.parameter_annotations) {
        parseAnnotations(pa, e);
    }
    p.add(e);
    return null;
}
Also used : Element(xmlkit.XMLKit.Element) TypeAnnotation(com.sun.tools.classfile.TypeAnnotation) Annotation(com.sun.tools.classfile.Annotation)

Aggregations

Annotation (com.sun.tools.classfile.Annotation)7 TypeAnnotation (com.sun.tools.classfile.TypeAnnotation)4 Element (xmlkit.XMLKit.Element)4 Attribute (com.sun.tools.classfile.Attribute)2 RuntimeAnnotations_attribute (com.sun.tools.classfile.RuntimeAnnotations_attribute)2 ClassFile (com.sun.tools.classfile.ClassFile)1 Method (java.lang.reflect.Method)1