Пример #1
0
 @Test
 public void testGetTargetBlockMethodInSuperInterface() throws Exception {
   assertEquals(
       toSootClass(F.class).getMethodByName("run"),
       ObjCBlockPlugin.getBlockTargetMethod(
           toSootClass(Runners.class).getMethodByName("runner2"), 0));
 }
Пример #2
0
 @Test
 public void testGetTargetBlockMethodDirect2() throws Exception {
   assertEquals(
       toSootClass(Runnable.class).getMethodByName("run"),
       ObjCBlockPlugin.getBlockTargetMethod(
           toSootClass(Runners.class).getMethodByName("runner9"), 0));
 }
Пример #3
0
  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]);
    }
  }
Пример #4
0
 @Test(expected = CompilerException.class)
 public void testGetTargetBlockMethodNoMethods() throws Exception {
   ObjCBlockPlugin.getBlockTargetMethod(toSootClass(Runners.class).getMethodByName("runner12"), 0);
 }