Search in sources :

Example 1 with AttRuntimeVisibleAnnotations

use of com.taobao.android.dx.cf.attrib.AttRuntimeVisibleAnnotations in project atlas by alibaba.

the class AttributeTranslator method getAnnotations0.

/**
 * Helper method for {@link #getAnnotations} which just gets the
 * existing annotations, per se.
 *
 * @param attribs {@code non-null;} the attributes list to search in
 * @return {@code non-null;} the set of annotations, which may be empty
 */
private static Annotations getAnnotations0(AttributeList attribs) {
    AttRuntimeVisibleAnnotations visible = (AttRuntimeVisibleAnnotations) attribs.findFirst(AttRuntimeVisibleAnnotations.ATTRIBUTE_NAME);
    AttRuntimeInvisibleAnnotations invisible = (AttRuntimeInvisibleAnnotations) attribs.findFirst(AttRuntimeInvisibleAnnotations.ATTRIBUTE_NAME);
    if (visible == null) {
        if (invisible == null) {
            return Annotations.EMPTY;
        }
        return invisible.getAnnotations();
    }
    if (invisible == null) {
        return visible.getAnnotations();
    }
    return Annotations.combine(visible.getAnnotations(), invisible.getAnnotations());
}
Also used : AttRuntimeVisibleAnnotations(com.taobao.android.dx.cf.attrib.AttRuntimeVisibleAnnotations) AttRuntimeInvisibleAnnotations(com.taobao.android.dx.cf.attrib.AttRuntimeInvisibleAnnotations)

Example 2 with AttRuntimeVisibleAnnotations

use of com.taobao.android.dx.cf.attrib.AttRuntimeVisibleAnnotations in project atlas by alibaba.

the class StdAttributeFactory method runtimeVisibleAnnotations.

/**
 * Parses a {@code RuntimeVisibleAnnotations} attribute.
 */
private Attribute runtimeVisibleAnnotations(DirectClassFile cf, int offset, int length, ParseObserver observer) {
    if (length < 2) {
        throwSeverelyTruncated();
    }
    AnnotationParser ap = new AnnotationParser(cf, offset, length, observer);
    Annotations annotations = ap.parseAnnotationAttribute(AnnotationVisibility.RUNTIME);
    return new AttRuntimeVisibleAnnotations(annotations, length);
}
Also used : AttRuntimeVisibleAnnotations(com.taobao.android.dx.cf.attrib.AttRuntimeVisibleAnnotations) AttRuntimeVisibleParameterAnnotations(com.taobao.android.dx.cf.attrib.AttRuntimeVisibleParameterAnnotations) AttRuntimeInvisibleParameterAnnotations(com.taobao.android.dx.cf.attrib.AttRuntimeInvisibleParameterAnnotations) AttRuntimeInvisibleAnnotations(com.taobao.android.dx.cf.attrib.AttRuntimeInvisibleAnnotations) Annotations(com.taobao.android.dx.rop.annotation.Annotations) AttRuntimeVisibleAnnotations(com.taobao.android.dx.cf.attrib.AttRuntimeVisibleAnnotations)

Aggregations

AttRuntimeInvisibleAnnotations (com.taobao.android.dx.cf.attrib.AttRuntimeInvisibleAnnotations)2 AttRuntimeVisibleAnnotations (com.taobao.android.dx.cf.attrib.AttRuntimeVisibleAnnotations)2 AttRuntimeInvisibleParameterAnnotations (com.taobao.android.dx.cf.attrib.AttRuntimeInvisibleParameterAnnotations)1 AttRuntimeVisibleParameterAnnotations (com.taobao.android.dx.cf.attrib.AttRuntimeVisibleParameterAnnotations)1 Annotations (com.taobao.android.dx.rop.annotation.Annotations)1