Search in sources :

Example 11 with SootMethod

use of soot.SootMethod in project robovm by robovm.

the class SootClassType method getEnclosingMethod.

private SootMethodType getEnclosingMethod(boolean constructor) {
    EnclosingMethodTag emTag = (EnclosingMethodTag) sootClass.getTag("EnclosingMethodTag");
    if (emTag != null) {
        String clsName = emTag.getEnclosingClass();
        String name = emTag.getEnclosingMethod();
        String desc = emTag.getEnclosingMethodSig();
        if (clsName != null && name != null && desc != null) {
            if ((constructor && name.equals("<init>")) || (!constructor && !name.equals("<init>") && !name.equals("<clinit>"))) {
                SootClass cls = SootResolver.v().makeClassRef(clsName);
                if (!cls.isPhantom()) {
                    for (SootMethod m : cls.getMethods()) {
                        String mDesc = org.robovm.compiler.Types.getDescriptor(m);
                        if (m.getName().equals(name) && desc.equals(mDesc)) {
                            return new SootMethodType(m);
                        }
                    }
                }
            }
        }
    }
    return null;
}
Also used : EnclosingMethodTag(soot.tagkit.EnclosingMethodTag) SootMethod(soot.SootMethod) SootClass(soot.SootClass)

Example 12 with SootMethod

use of soot.SootMethod in project robovm by robovm.

the class AnnotationsTest method testCopyParameterAnnotationsNoParams.

@Test
public void testCopyParameterAnnotationsNoParams() {
    SootClass sc = toSootClass(getClass());
    SootMethod src = sc.getMethodByName("src1");
    SootMethod dest = sc.getMethodByName("dest1");
    copyParameterAnnotations(src, dest, 0, 0, 0, Visibility.Any);
    assertEquals("void dest1()", toString(dest));
}
Also used : SootMethod(soot.SootMethod) SootClass(soot.SootClass) Test(org.junit.Test)

Example 13 with SootMethod

use of soot.SootMethod in project robovm by robovm.

the class AnnotationsTest method testCopyParameterAnnotationsOnlyInvisibleNoShift.

@Test
public void testCopyParameterAnnotationsOnlyInvisibleNoShift() {
    SootClass sc = toSootClass(getClass());
    SootMethod src = sc.getMethodByName("src9");
    SootMethod dest = sc.getMethodByName("dest9");
    copyParameterAnnotations(src, dest, 0, 2, 0, Visibility.RuntimeVisible);
    assertEquals("void dest9(int, @E int)", toString(dest));
}
Also used : SootMethod(soot.SootMethod) SootClass(soot.SootClass) Test(org.junit.Test)

Example 14 with SootMethod

use of soot.SootMethod in project robovm by robovm.

the class AnnotationsTest method testCopyParameterAnnotationsSingleAllNoShift.

@Test
public void testCopyParameterAnnotationsSingleAllNoShift() {
    SootClass sc = toSootClass(getClass());
    SootMethod src = sc.getMethodByName("src3");
    SootMethod dest = sc.getMethodByName("dest3");
    copyParameterAnnotations(src, dest, 0, 2, 0, Visibility.Any);
    assertEquals("void dest3(@A int, @B int)", toString(dest));
}
Also used : SootMethod(soot.SootMethod) SootClass(soot.SootClass) Test(org.junit.Test)

Example 15 with SootMethod

use of soot.SootMethod in project robovm by robovm.

the class AnnotationsTest method testCopyParameterAnnotationsNoAnnotations.

@Test
public void testCopyParameterAnnotationsNoAnnotations() {
    SootClass sc = toSootClass(getClass());
    SootMethod src = sc.getMethodByName("src2");
    SootMethod dest = sc.getMethodByName("dest2");
    copyParameterAnnotations(src, dest, 0, 2, 0, Visibility.Any);
    assertEquals("void dest2(int, int)", toString(dest));
}
Also used : SootMethod(soot.SootMethod) SootClass(soot.SootClass) Test(org.junit.Test)

Aggregations

SootMethod (soot.SootMethod)82 Test (org.junit.Test)34 SootClass (soot.SootClass)30 MarshalSite (org.robovm.compiler.MarshalerLookup.MarshalSite)21 PrimType (soot.PrimType)15 RefType (soot.RefType)14 VoidType (soot.VoidType)13 SootMethodType (org.robovm.compiler.util.generic.SootMethodType)11 DoubleType (soot.DoubleType)11 FloatType (soot.FloatType)11 LongType (soot.LongType)11 ArrayList (java.util.ArrayList)9 BooleanType (soot.BooleanType)9 SootField (soot.SootField)8 Type (soot.Type)8 Body (soot.Body)7 RefLikeType (soot.RefLikeType)7 CompilerException (org.robovm.compiler.CompilerException)6 Unit (soot.Unit)6 MethodVisitor (org.objectweb.asm.MethodVisitor)5