Search in sources :

Example 31 with SootMethod

use of soot.SootMethod in project robovm by robovm.

the class MarshalerLookupTest method testFindMarshalerStructMemberPrimitiveArray1D.

@Test
public void testFindMarshalerStructMemberPrimitiveArray1D() {
    MarshalerLookup lookup = new MarshalerLookup(config).searchBuiltins(false);
    SootMethod getter = toSootClass(TestStruct.class).getMethodByName("getV2");
    SootMethod setter = toSootClass(TestStruct.class).getMethodByName("setV2");
    assertEquals(toSootClass(M2.class).getMethodByName("byteArray1DToObject"), lookup.findMarshalerMethod(new MarshalSite(getter)).getMethod());
    assertEquals(toSootClass(M2.class).getMethodByName("byteArray1DToNative"), lookup.findMarshalerMethod(new MarshalSite(setter, 0)).getMethod());
}
Also used : MarshalSite(org.robovm.compiler.MarshalerLookup.MarshalSite) SootMethod(soot.SootMethod) Test(org.junit.Test)

Example 32 with SootMethod

use of soot.SootMethod in project robovm by robovm.

the class MarshalerLookupTest method testFindMarshalerMethodClassMatchArray.

@Test
public void testFindMarshalerMethodClassMatchArray() {
    MarshalerLookup lookup = new MarshalerLookup(config).searchBuiltins(false);
    SootMethod method = toSootClass(Foo4.class).getMethodByName("foo6");
    assertEquals(toSootClass(M2.class).getMethodByName("stringArrayToObject"), lookup.findMarshalerMethod(new MarshalSite(method)).getMethod());
    assertEquals(toSootClass(M2.class).getMethodByName("stringArrayToNative"), lookup.findMarshalerMethod(new MarshalSite(method, 0)).getMethod());
}
Also used : MarshalSite(org.robovm.compiler.MarshalerLookup.MarshalSite) SootMethod(soot.SootMethod) Test(org.junit.Test)

Example 33 with SootMethod

use of soot.SootMethod in project robovm by robovm.

the class MarshalerLookupTest method testFindMarshalerMethodUnsuccessfulSearchNoMarshalers.

@Test
public void testFindMarshalerMethodUnsuccessfulSearchNoMarshalers() {
    MarshalerLookup lookup = new MarshalerLookup(config).searchBuiltins(false);
    SootMethod method = toSootClass(Foo1.class).getMethodByName("foo");
    try {
        lookup.findMarshalerMethod(new MarshalSite(method));
        fail("IllegalArgumentException expected");
    } catch (IllegalArgumentException e) {
    }
    try {
        lookup.findMarshalerMethod(new MarshalSite(method, 0));
        fail("IllegalArgumentException expected");
    } catch (IllegalArgumentException e) {
    }
}
Also used : MarshalSite(org.robovm.compiler.MarshalerLookup.MarshalSite) SootMethod(soot.SootMethod) Test(org.junit.Test)

Example 34 with SootMethod

use of soot.SootMethod in project robovm by robovm.

the class MarshalerLookupTest method testFindMarshalerMethodClassMatchPointer.

@Test
public void testFindMarshalerMethodClassMatchPointer() {
    MarshalerLookup lookup = new MarshalerLookup(config).searchBuiltins(false);
    SootMethod method = toSootClass(Foo4.class).getMethodByName("foo1");
    assertEquals(toSootClass(M2.class).getMethodByName("stringToObject"), lookup.findMarshalerMethod(new MarshalSite(method)).getMethod());
    assertEquals(toSootClass(M2.class).getMethodByName("stringToNative"), lookup.findMarshalerMethod(new MarshalSite(method, 0)).getMethod());
}
Also used : MarshalSite(org.robovm.compiler.MarshalerLookup.MarshalSite) SootMethod(soot.SootMethod) Test(org.junit.Test)

Example 35 with SootMethod

use of soot.SootMethod in project robovm by robovm.

the class MarshalerLookupTest method testFindMarshalerMethodUnsuccessfulSearchUnsupportedCallTypeStructMember.

@Test
public void testFindMarshalerMethodUnsuccessfulSearchUnsupportedCallTypeStructMember() {
    MarshalerLookup lookup = new MarshalerLookup(config).searchBuiltins(false);
    SootMethod getter = toSootClass(TestStruct.class).getMethodByName("getV1");
    SootMethod setter = toSootClass(TestStruct.class).getMethodByName("setV1");
    try {
        lookup.findMarshalerMethod(new MarshalSite(getter)).getMethod();
        fail("IllegalArgumentException expected");
    } catch (IllegalArgumentException e) {
    }
    try {
        lookup.findMarshalerMethod(new MarshalSite(setter, 0)).getMethod();
        fail("IllegalArgumentException expected");
    } catch (IllegalArgumentException e) {
    }
}
Also used : MarshalSite(org.robovm.compiler.MarshalerLookup.MarshalSite) SootMethod(soot.SootMethod) 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