Search in sources :

Example 6 with SootClass

use of soot.SootClass 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 7 with SootClass

use of soot.SootClass 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 8 with SootClass

use of soot.SootClass 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 9 with SootClass

use of soot.SootClass 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 10 with SootClass

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

SootClass (soot.SootClass)48 SootMethod (soot.SootMethod)30 Test (org.junit.Test)15 ArrayList (java.util.ArrayList)9 PrimType (soot.PrimType)9 RefType (soot.RefType)8 SootField (soot.SootField)7 HashSet (java.util.HashSet)6 ConstantBitcast (org.robovm.compiler.llvm.ConstantBitcast)4 Global (org.robovm.compiler.llvm.Global)4 IntegerConstant (org.robovm.compiler.llvm.IntegerConstant)4 Type (org.robovm.compiler.llvm.Type)4 File (java.io.File)3 CompilerException (org.robovm.compiler.CompilerException)3 Entry (org.robovm.compiler.VTable.Entry)3 ArrayType (org.robovm.compiler.llvm.ArrayType)3 NullConstant (org.robovm.compiler.llvm.NullConstant)3 PointerType (org.robovm.compiler.llvm.PointerType)3 StructureConstant (org.robovm.compiler.llvm.StructureConstant)3 StructureConstantBuilder (org.robovm.compiler.llvm.StructureConstantBuilder)3