Search in sources :

Example 21 with AnnotationTag

use of soot.tagkit.AnnotationTag 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

AnnotationTag (soot.tagkit.AnnotationTag)21 ArrayList (java.util.ArrayList)7 VisibilityAnnotationTag (soot.tagkit.VisibilityAnnotationTag)7 VisibilityParameterAnnotationTag (soot.tagkit.VisibilityParameterAnnotationTag)7 Tag (soot.tagkit.Tag)4 Type (org.robovm.compiler.llvm.Type)3 Value (org.robovm.compiler.llvm.Value)3 VoidType (soot.VoidType)3 AnnotationClassElem (soot.tagkit.AnnotationClassElem)3 CompilerException (org.robovm.compiler.CompilerException)2 Clazz (org.robovm.compiler.clazz.Clazz)2 Br (org.robovm.compiler.llvm.Br)2 Function (org.robovm.compiler.llvm.Function)2 Global (org.robovm.compiler.llvm.Global)2 Icmp (org.robovm.compiler.llvm.Icmp)2 IntegerConstant (org.robovm.compiler.llvm.IntegerConstant)2 Label (org.robovm.compiler.llvm.Label)2 Load (org.robovm.compiler.llvm.Load)2 NullConstant (org.robovm.compiler.llvm.NullConstant)2 PointerType (org.robovm.compiler.llvm.PointerType)2