Search in sources :

Example 16 with MarshalSite

use of org.robovm.compiler.MarshalerLookup.MarshalSite in project robovm by robovm.

the class MarshalerLookupTest method testFindMarshalerStructMemberByteBuffer1D.

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

Example 17 with MarshalSite

use of org.robovm.compiler.MarshalerLookup.MarshalSite in project robovm by robovm.

the class MarshalerLookupTest method testFindMarshalerMethodUnsuccessfulWithMarshalerAnnotation.

@Test
public void testFindMarshalerMethodUnsuccessfulWithMarshalerAnnotation() {
    MarshalerLookup lookup = new MarshalerLookup(config).searchBuiltins(false);
    SootMethod method = toSootClass(Foo3.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 18 with MarshalSite

use of org.robovm.compiler.MarshalerLookup.MarshalSite in project robovm by robovm.

the class MarshalerLookupTest method testFindMarshalerMethodInterfaceMatchArray.

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

Example 19 with MarshalSite

use of org.robovm.compiler.MarshalerLookup.MarshalSite in project robovm by robovm.

the class MarshalerLookupTest method testFindMarshalerMethodSuperclassMatchArray.

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

Example 20 with MarshalSite

use of org.robovm.compiler.MarshalerLookup.MarshalSite in project robovm by robovm.

the class MarshalerLookupTest method testFindMarshalerMethodClassMatchValue.

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

Aggregations

MarshalSite (org.robovm.compiler.MarshalerLookup.MarshalSite)27 SootMethod (soot.SootMethod)21 Test (org.junit.Test)18 MarshalerMethod (org.robovm.compiler.MarshalerLookup.MarshalerMethod)9 StructureType (org.robovm.compiler.llvm.StructureType)6 ArrayMarshalerMethod (org.robovm.compiler.MarshalerLookup.ArrayMarshalerMethod)5 ValueMarshalerMethod (org.robovm.compiler.MarshalerLookup.ValueMarshalerMethod)5 PrimitiveType (org.robovm.compiler.llvm.PrimitiveType)5 PointerMarshalerMethod (org.robovm.compiler.MarshalerLookup.PointerMarshalerMethod)4 IntegerConstant (org.robovm.compiler.llvm.IntegerConstant)4 PointerType (org.robovm.compiler.llvm.PointerType)4 ArrayType (org.robovm.compiler.llvm.ArrayType)3 FunctionType (org.robovm.compiler.llvm.FunctionType)3 Type (org.robovm.compiler.llvm.Type)3 Value (org.robovm.compiler.llvm.Value)3 PrimType (soot.PrimType)3 ArrayList (java.util.ArrayList)2 BasicBlockRef (org.robovm.compiler.llvm.BasicBlockRef)2 Bitcast (org.robovm.compiler.llvm.Bitcast)2 ConstantBitcast (org.robovm.compiler.llvm.ConstantBitcast)2