Search in sources :

Example 1 with AnnotationElem

use of soot.tagkit.AnnotationElem in project robovm by robovm.

the class Bro method getArrayDimensions.

public static int[] getArrayDimensions(SootMethod method, int paramIndex) {
    AnnotationTag annotation = paramIndex == -1 ? getArrayAnnotation(method) : getArrayAnnotation(method, paramIndex);
    if (annotation == null) {
        return null;
    }
    ArrayList<AnnotationElem> values = ((AnnotationArrayElem) annotation.getElemAt(0)).getValues();
    int[] dims = new int[values.size()];
    for (int i = 0; i < dims.length; i++) {
        dims[i] = ((AnnotationIntElem) values.get(i)).getValue();
    }
    return dims;
}
Also used : AnnotationTag(soot.tagkit.AnnotationTag) AnnotationArrayElem(soot.tagkit.AnnotationArrayElem) AnnotationElem(soot.tagkit.AnnotationElem)

Example 2 with AnnotationElem

use of soot.tagkit.AnnotationElem in project robovm by robovm.

the class Annotations method getMarshalerAnnotations.

public static List<AnnotationTag> getMarshalerAnnotations(SootClass clazz) {
    List<AnnotationTag> tags = new ArrayList<AnnotationTag>();
    AnnotationTag marshaler = getAnnotation(clazz, MARSHALER);
    if (marshaler != null) {
        tags.add(marshaler);
    } else {
        AnnotationTag marshalers = getAnnotation(clazz, MARSHALERS);
        if (marshalers != null) {
            for (AnnotationElem e : ((AnnotationArrayElem) marshalers.getElemAt(0)).getValues()) {
                AnnotationAnnotationElem elem = (AnnotationAnnotationElem) e;
                tags.add(elem.getValue());
            }
        }
    }
    return tags;
}
Also used : AnnotationTag(soot.tagkit.AnnotationTag) VisibilityParameterAnnotationTag(soot.tagkit.VisibilityParameterAnnotationTag) VisibilityAnnotationTag(soot.tagkit.VisibilityAnnotationTag) AnnotationAnnotationElem(soot.tagkit.AnnotationAnnotationElem) ArrayList(java.util.ArrayList) AnnotationArrayElem(soot.tagkit.AnnotationArrayElem) AnnotationAnnotationElem(soot.tagkit.AnnotationAnnotationElem) AnnotationElem(soot.tagkit.AnnotationElem)

Example 3 with AnnotationElem

use of soot.tagkit.AnnotationElem in project robovm by robovm.

the class MarshalerLookup method getSupportedCallTypes.

private Set<Long> getSupportedCallTypes(AnnotationTag anno) {
    AnnotationArrayElem el = (AnnotationArrayElem) getElemByName(anno, "supportedCallTypes");
    if (el == null) {
        return new HashSet<Long>(Arrays.asList(Bro.MarshalerFlags.CALL_TYPE_BRIDGE, Bro.MarshalerFlags.CALL_TYPE_CALLBACK, Bro.MarshalerFlags.CALL_TYPE_STRUCT_MEMBER, Bro.MarshalerFlags.CALL_TYPE_GLOBAL_VALUE, Bro.MarshalerFlags.CALL_TYPE_PTR));
    }
    ArrayList<AnnotationElem> values = ((AnnotationArrayElem) el).getValues();
    Set<Long> callTypes = new HashSet<>();
    for (AnnotationElem value : values) {
        callTypes.add(((AnnotationLongElem) value).getValue());
    }
    return callTypes;
}
Also used : AnnotationArrayElem(soot.tagkit.AnnotationArrayElem) AnnotationElem(soot.tagkit.AnnotationElem) HashSet(java.util.HashSet)

Aggregations

AnnotationArrayElem (soot.tagkit.AnnotationArrayElem)3 AnnotationElem (soot.tagkit.AnnotationElem)3 AnnotationTag (soot.tagkit.AnnotationTag)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 AnnotationAnnotationElem (soot.tagkit.AnnotationAnnotationElem)1 VisibilityAnnotationTag (soot.tagkit.VisibilityAnnotationTag)1 VisibilityParameterAnnotationTag (soot.tagkit.VisibilityParameterAnnotationTag)1