Search in sources :

Example 11 with AttributeList

use of com.android.dx.cf.iface.AttributeList 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

AttributeList (com.android.dx.cf.iface.AttributeList)11 AttRuntimeInvisibleParameterAnnotations (com.android.dx.cf.attrib.AttRuntimeInvisibleParameterAnnotations)4 AttRuntimeVisibleParameterAnnotations (com.android.dx.cf.attrib.AttRuntimeVisibleParameterAnnotations)4 Annotation (com.android.dx.rop.annotation.Annotation)4 CstType (com.android.dx.rop.cst.CstType)4 Attribute (com.android.dx.cf.iface.Attribute)3 AttAnnotationDefault (com.android.dx.cf.attrib.AttAnnotationDefault)2 AttEnclosingMethod (com.android.dx.cf.attrib.AttEnclosingMethod)2 AttExceptions (com.android.dx.cf.attrib.AttExceptions)2 AttRuntimeInvisibleAnnotations (com.android.dx.cf.attrib.AttRuntimeInvisibleAnnotations)2 AttRuntimeVisibleAnnotations (com.android.dx.cf.attrib.AttRuntimeVisibleAnnotations)2 AttSourceFile (com.android.dx.cf.attrib.AttSourceFile)2 Method (com.android.dx.cf.iface.Method)2 MethodList (com.android.dx.cf.iface.MethodList)2 StdAttributeList (com.android.dx.cf.iface.StdAttributeList)2 Annotations (com.android.dx.rop.annotation.Annotations)2 NameValuePair (com.android.dx.rop.annotation.NameValuePair)2 Warning (com.android.dx.util.Warning)2 BaseAnnotations (com.android.dx.cf.attrib.BaseAnnotations)1 ClassPathOpener (com.android.dx.cf.direct.ClassPathOpener)1