Пример #1
0
 @Test(expected = CompilerException.class)
 public void testResolveTargetMethodSignatureGenericWithUnresolvedDirectTypeVariable()
     throws Exception {
   SootMethod target = toSootClass(F.class).getMethodByName("run");
   SootMethod m = toSootClass(Runners.class).getMethodByName("runner8");
   SootMethodType mType = new SootMethodType(m);
   ObjCBlockPlugin.resolveTargetMethodSignature(m, target, mType.getGenericParameterTypes()[0]);
 }
Пример #2
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]);
    }
  }