Search in sources :

Example 6 with VisibilityAnnotationTag

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

the class Annotations method addRuntimeVisibleParameterAnnotation.

public static void addRuntimeVisibleParameterAnnotation(SootMethod method, int paramIndex, AnnotationTag annoTag) {
    removeParameterAnnotation(method, paramIndex, annoTag.getType());
    VisibilityAnnotationTag tag = getOrCreateRuntimeVisibilityAnnotationTag(method, paramIndex);
    tag.addAnnotation(annoTag);
}
Also used : VisibilityAnnotationTag(soot.tagkit.VisibilityAnnotationTag)

Example 7 with VisibilityAnnotationTag

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

the class Annotations method addRuntimeVisibleParameterAnnotation.

public static void addRuntimeVisibleParameterAnnotation(SootMethod method, int paramIndex, String annotationType) {
    if (!hasParameterAnnotation(method, paramIndex, annotationType)) {
        VisibilityAnnotationTag tag = getOrCreateRuntimeVisibilityAnnotationTag(method, paramIndex);
        tag.addAnnotation(new AnnotationTag(annotationType, 0));
    }
}
Also used : AnnotationTag(soot.tagkit.AnnotationTag) VisibilityParameterAnnotationTag(soot.tagkit.VisibilityParameterAnnotationTag) VisibilityAnnotationTag(soot.tagkit.VisibilityAnnotationTag) VisibilityAnnotationTag(soot.tagkit.VisibilityAnnotationTag)

Example 8 with VisibilityAnnotationTag

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

the class Annotations method getParameterAnnotations.

public static List<AnnotationTag>[] getParameterAnnotations(SootMethod method, Visibility visibility) {
    @SuppressWarnings("unchecked") ArrayList<AnnotationTag>[] result = new ArrayList[method.getParameterCount()];
    for (int i = 0; i < result.length; i++) {
        result[i] = new ArrayList<>();
    }
    for (Tag tag : method.getTags()) {
        if (tag instanceof VisibilityParameterAnnotationTag) {
            if (visibility == Visibility.Any || ((VisibilityParameterAnnotationTag) tag).getKind() == visibility.ordinal()) {
                ArrayList<VisibilityAnnotationTag> l = ((VisibilityParameterAnnotationTag) tag).getVisibilityAnnotations();
                if (l != null) {
                    int i = 0;
                    for (VisibilityAnnotationTag t : l) {
                        ArrayList<AnnotationTag> annotations = t.getAnnotations();
                        if (annotations != null) {
                            result[i].addAll(annotations);
                        }
                        i++;
                    }
                }
            }
        }
    }
    return result;
}
Also used : AnnotationTag(soot.tagkit.AnnotationTag) VisibilityParameterAnnotationTag(soot.tagkit.VisibilityParameterAnnotationTag) VisibilityAnnotationTag(soot.tagkit.VisibilityAnnotationTag) VisibilityParameterAnnotationTag(soot.tagkit.VisibilityParameterAnnotationTag) ArrayList(java.util.ArrayList) VisibilityAnnotationTag(soot.tagkit.VisibilityAnnotationTag) Tag(soot.tagkit.Tag) AnnotationTag(soot.tagkit.AnnotationTag) VisibilityParameterAnnotationTag(soot.tagkit.VisibilityParameterAnnotationTag) VisibilityAnnotationTag(soot.tagkit.VisibilityAnnotationTag)

Example 9 with VisibilityAnnotationTag

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

the class Annotations method addRuntimeVisibleAnnotation.

public static void addRuntimeVisibleAnnotation(Host host, String annotationType) {
    if (!hasAnnotation(host, annotationType)) {
        VisibilityAnnotationTag tag = getOrCreateRuntimeVisibilityAnnotationTag(host);
        tag.addAnnotation(new AnnotationTag(annotationType, 0));
    }
}
Also used : AnnotationTag(soot.tagkit.AnnotationTag) VisibilityParameterAnnotationTag(soot.tagkit.VisibilityParameterAnnotationTag) VisibilityAnnotationTag(soot.tagkit.VisibilityAnnotationTag) VisibilityAnnotationTag(soot.tagkit.VisibilityAnnotationTag)

Example 10 with VisibilityAnnotationTag

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

the class Annotations method copyParameterAnnotations.

private static void copyParameterAnnotations(SootMethod fromMethod, SootMethod toMethod, int start, int end, int shift, int visibility) {
    List<AnnotationTag>[] fromAnnos = getParameterAnnotations(fromMethod, Visibility.values()[visibility]);
    List<AnnotationTag>[] toAnnos = getParameterAnnotations(toMethod, Visibility.values()[visibility]);
    for (int i = start; i < end; i++) {
        toAnnos[i + shift].addAll(fromAnnos[i]);
    }
    for (Iterator<Tag> it = toMethod.getTags().iterator(); it.hasNext(); ) {
        Tag tag = it.next();
        if (tag instanceof VisibilityParameterAnnotationTag) {
            if (((VisibilityParameterAnnotationTag) tag).getKind() == visibility) {
                it.remove();
            }
        }
    }
    VisibilityParameterAnnotationTag vpaTag = new VisibilityParameterAnnotationTag(toAnnos.length, visibility);
    for (List<AnnotationTag> annos : toAnnos) {
        VisibilityAnnotationTag vaTag = new VisibilityAnnotationTag(visibility);
        for (AnnotationTag anno : annos) {
            vaTag.addAnnotation(anno);
        }
        vpaTag.addVisibilityAnnotation(vaTag);
    }
    toMethod.addTag(vpaTag);
}
Also used : AnnotationTag(soot.tagkit.AnnotationTag) VisibilityParameterAnnotationTag(soot.tagkit.VisibilityParameterAnnotationTag) VisibilityAnnotationTag(soot.tagkit.VisibilityAnnotationTag) VisibilityParameterAnnotationTag(soot.tagkit.VisibilityParameterAnnotationTag) VisibilityAnnotationTag(soot.tagkit.VisibilityAnnotationTag) ArrayList(java.util.ArrayList) List(java.util.List) Tag(soot.tagkit.Tag) AnnotationTag(soot.tagkit.AnnotationTag) VisibilityParameterAnnotationTag(soot.tagkit.VisibilityParameterAnnotationTag) VisibilityAnnotationTag(soot.tagkit.VisibilityAnnotationTag)

Aggregations

VisibilityAnnotationTag (soot.tagkit.VisibilityAnnotationTag)10 AnnotationTag (soot.tagkit.AnnotationTag)8 VisibilityParameterAnnotationTag (soot.tagkit.VisibilityParameterAnnotationTag)8 Tag (soot.tagkit.Tag)6 ArrayList (java.util.ArrayList)4 List (java.util.List)1 ArrayConstant (org.robovm.compiler.llvm.ArrayConstant)1 ArrayType (org.robovm.compiler.llvm.ArrayType)1 IntegerConstant (org.robovm.compiler.llvm.IntegerConstant)1 PackedStructureConstant (org.robovm.compiler.llvm.PackedStructureConstant)1 PackedStructureType (org.robovm.compiler.llvm.PackedStructureType)1 StructureConstant (org.robovm.compiler.llvm.StructureConstant)1 Type (org.robovm.compiler.llvm.Type)1 Value (org.robovm.compiler.llvm.Value)1 SootClass (soot.SootClass)1 SootMethod (soot.SootMethod)1 AnnotationDefaultTag (soot.tagkit.AnnotationDefaultTag)1 EnclosingMethodTag (soot.tagkit.EnclosingMethodTag)1 InnerClassTag (soot.tagkit.InnerClassTag)1 SignatureTag (soot.tagkit.SignatureTag)1