private static MethodHandle bindCallSite(MethodCallSite site) throws IllegalAccessException {
    MethodHandle mh =
        RobolectricInternals.findShadowMethod(
            site.getCaller(), site.getName(), site.type(), site.isStatic());

    if (mh == null) {
      // Call original code and make sure to clean stack traces
      mh = cleanStackTraces(site.getOriginal());
    } else if (mh == ShadowWrangler.DO_NOTHING) {
      mh = dropArguments(mh, 0, site.type().parameterList());
    } else if (!site.isStatic()) {
      Class<?> shadowType = mh.type().parameterType(0);
      mh = filterArguments(mh, 0, GET_SHADOW.asType(methodType(shadowType, site.thisType())));
    }

    try {
      return bindWithFallback(mh, site, BIND_CALL_SITE);
    } catch (Throwable t) {
      // The error that bubbles up is currently not very helpful so we print any error messages
      // here
      t.printStackTrace();
      System.err.println(site.getCaller());
      throw t;
    }
  }
 private static MethodHandle bindInitCallSite(RoboCallSite site) {
   MethodHandle mh = RobolectricInternals.getShadowCreator(site.getCaller());
   return bindWithFallback(mh, site, BIND_INIT_CALL_SITE);
 }
 private static SwitchPoint getInvalidator(Class<?> cl) {
   return RobolectricInternals.getShadowInvalidator().getSwitchPoint(cl);
 }