Search in sources :

Example 6 with SootMethodType

use of org.robovm.compiler.util.generic.SootMethodType in project robovm by robovm.

the class ObjCBlockPluginTest method testResolveTargetMethodSignature.

private void testResolveTargetMethodSignature(String runnerMethodName, Type expectedReturnType, Type... expectedParamTypes) {
    SootMethod m = toSootClass(Runners.class).getMethodByName(runnerMethodName);
    SootMethodType mType = new SootMethodType(m);
    SootMethod target = ObjCBlockPlugin.getBlockTargetMethod(m, 0);
    Type[] types = ObjCBlockPlugin.resolveTargetMethodSignature(m, target, mType.getGenericParameterTypes()[0]);
    assertEquals(target.getParameterCount() + 1, types.length);
    assertEquals(expectedReturnType, types[0]);
    for (int i = 0; i < types.length - 1; i++) {
        assertEquals(expectedParamTypes[i], types[i + 1]);
    }
}
Also used : SootTypeType(org.robovm.compiler.util.generic.SootTypeType) SootMethodType(org.robovm.compiler.util.generic.SootMethodType) SootClassType(org.robovm.compiler.util.generic.SootClassType) VoidType(soot.VoidType) Type(org.robovm.compiler.util.generic.Type) BooleanType(soot.BooleanType) SootMethodType(org.robovm.compiler.util.generic.SootMethodType) SootMethod(soot.SootMethod)

Example 7 with SootMethodType

use of org.robovm.compiler.util.generic.SootMethodType in project robovm by robovm.

the class ObjCBlockPluginTest method testResolveTargetMethodSignatureGenericWithUnresolvedIndirectTypeVariable.

@Test(expected = CompilerException.class)
public void testResolveTargetMethodSignatureGenericWithUnresolvedIndirectTypeVariable() throws Exception {
    SootMethod target = toSootClass(F.class).getMethodByName("run");
    SootMethod m = toSootClass(Runners.class).getMethodByName("runner7");
    SootMethodType mType = new SootMethodType(m);
    ObjCBlockPlugin.resolveTargetMethodSignature(m, target, mType.getGenericParameterTypes()[0]);
}
Also used : SootMethodType(org.robovm.compiler.util.generic.SootMethodType) SootMethod(soot.SootMethod) Test(org.junit.Test)

Aggregations

SootMethodType (org.robovm.compiler.util.generic.SootMethodType)7 SootMethod (soot.SootMethod)5 SootClassType (org.robovm.compiler.util.generic.SootClassType)3 SootTypeType (org.robovm.compiler.util.generic.SootTypeType)3 Type (org.robovm.compiler.util.generic.Type)3 BooleanType (soot.BooleanType)3 VoidType (soot.VoidType)3 Test (org.junit.Test)2 GenericArrayType (org.robovm.compiler.util.generic.GenericArrayType)2 ImplForType (org.robovm.compiler.util.generic.ImplForType)2 ParameterizedType (org.robovm.compiler.util.generic.ParameterizedType)2 WildcardType (org.robovm.compiler.util.generic.WildcardType)2 ByteType (soot.ByteType)2 CharType (soot.CharType)2 DoubleType (soot.DoubleType)2 FloatType (soot.FloatType)2 IntType (soot.IntType)2 LongType (soot.LongType)2 PrimType (soot.PrimType)2 RefType (soot.RefType)2