Search in sources :

Example 1 with AttRuntimeInvisibleParameterAnnotations

use of com.android.dx.cf.attrib.AttRuntimeInvisibleParameterAnnotations in project buck by facebook.

the class AttributeTranslator method getParameterAnnotations.

/**
     * Gets the parameter annotations out of a given method. This
     * combines both visible and invisible annotations into a single
     * result set.
     *
     * @param method {@code non-null;} the method in question
     * @return {@code non-null;} the list of annotation sets, which may be
     * empty
     */
public static AnnotationsList getParameterAnnotations(Method method) {
    AttributeList attribs = method.getAttributes();
    AttRuntimeVisibleParameterAnnotations visible = (AttRuntimeVisibleParameterAnnotations) attribs.findFirst(AttRuntimeVisibleParameterAnnotations.ATTRIBUTE_NAME);
    AttRuntimeInvisibleParameterAnnotations invisible = (AttRuntimeInvisibleParameterAnnotations) attribs.findFirst(AttRuntimeInvisibleParameterAnnotations.ATTRIBUTE_NAME);
    if (visible == null) {
        if (invisible == null) {
            return AnnotationsList.EMPTY;
        }
        return invisible.getParameterAnnotations();
    }
    if (invisible == null) {
        return visible.getParameterAnnotations();
    }
    return AnnotationsList.combine(visible.getParameterAnnotations(), invisible.getParameterAnnotations());
}
Also used : AttributeList(com.android.dx.cf.iface.AttributeList) AttRuntimeVisibleParameterAnnotations(com.android.dx.cf.attrib.AttRuntimeVisibleParameterAnnotations) AttRuntimeInvisibleParameterAnnotations(com.android.dx.cf.attrib.AttRuntimeInvisibleParameterAnnotations)

Example 2 with AttRuntimeInvisibleParameterAnnotations

use of com.android.dx.cf.attrib.AttRuntimeInvisibleParameterAnnotations in project buck by facebook.

the class StdAttributeFactory method runtimeInvisibleParameterAnnotations.

/**
     * Parses a {@code RuntimeInvisibleParameterAnnotations} attribute.
     */
private Attribute runtimeInvisibleParameterAnnotations(DirectClassFile cf, int offset, int length, ParseObserver observer) {
    if (length < 2) {
        throwSeverelyTruncated();
    }
    AnnotationParser ap = new AnnotationParser(cf, offset, length, observer);
    AnnotationsList list = ap.parseParameterAttribute(AnnotationVisibility.BUILD);
    return new AttRuntimeInvisibleParameterAnnotations(list, length);
}
Also used : AnnotationsList(com.android.dx.rop.annotation.AnnotationsList) AttRuntimeInvisibleParameterAnnotations(com.android.dx.cf.attrib.AttRuntimeInvisibleParameterAnnotations)

Example 3 with AttRuntimeInvisibleParameterAnnotations

use of com.android.dx.cf.attrib.AttRuntimeInvisibleParameterAnnotations in project J2ME-Loader by nikita36078.

the class StdAttributeFactory method runtimeInvisibleParameterAnnotations.

/**
 * Parses a {@code RuntimeInvisibleParameterAnnotations} attribute.
 */
private Attribute runtimeInvisibleParameterAnnotations(DirectClassFile cf, int offset, int length, ParseObserver observer) {
    if (length < 2) {
        throwSeverelyTruncated();
    }
    AnnotationParser ap = new AnnotationParser(cf, offset, length, observer);
    AnnotationsList list = ap.parseParameterAttribute(AnnotationVisibility.BUILD);
    return new AttRuntimeInvisibleParameterAnnotations(list, length);
}
Also used : AnnotationsList(com.android.dx.rop.annotation.AnnotationsList) AttRuntimeInvisibleParameterAnnotations(com.android.dx.cf.attrib.AttRuntimeInvisibleParameterAnnotations)

Example 4 with AttRuntimeInvisibleParameterAnnotations

use of com.android.dx.cf.attrib.AttRuntimeInvisibleParameterAnnotations in project J2ME-Loader by nikita36078.

the class AttributeTranslator method getParameterAnnotations.

/**
 * Gets the parameter annotations out of a given method. This
 * combines both visible and invisible annotations into a single
 * result set.
 *
 * @param method {@code non-null;} the method in question
 * @return {@code non-null;} the list of annotation sets, which may be
 * empty
 */
public static AnnotationsList getParameterAnnotations(Method method) {
    AttributeList attribs = method.getAttributes();
    AttRuntimeVisibleParameterAnnotations visible = (AttRuntimeVisibleParameterAnnotations) attribs.findFirst(AttRuntimeVisibleParameterAnnotations.ATTRIBUTE_NAME);
    AttRuntimeInvisibleParameterAnnotations invisible = (AttRuntimeInvisibleParameterAnnotations) attribs.findFirst(AttRuntimeInvisibleParameterAnnotations.ATTRIBUTE_NAME);
    if (visible == null) {
        if (invisible == null) {
            return AnnotationsList.EMPTY;
        }
        return invisible.getParameterAnnotations();
    }
    if (invisible == null) {
        return visible.getParameterAnnotations();
    }
    return AnnotationsList.combine(visible.getParameterAnnotations(), invisible.getParameterAnnotations());
}
Also used : AttributeList(com.android.dx.cf.iface.AttributeList) AttRuntimeVisibleParameterAnnotations(com.android.dx.cf.attrib.AttRuntimeVisibleParameterAnnotations) AttRuntimeInvisibleParameterAnnotations(com.android.dx.cf.attrib.AttRuntimeInvisibleParameterAnnotations)

Aggregations

AttRuntimeInvisibleParameterAnnotations (com.android.dx.cf.attrib.AttRuntimeInvisibleParameterAnnotations)4 AttRuntimeVisibleParameterAnnotations (com.android.dx.cf.attrib.AttRuntimeVisibleParameterAnnotations)2 AttributeList (com.android.dx.cf.iface.AttributeList)2 AnnotationsList (com.android.dx.rop.annotation.AnnotationsList)2