private static boolean maybeRenameParentConstructorCall()

in TransformCore/src/main/java/com/facebook/ads/injkit/crashshield/CrashShieldInjector.java [227:251]


  private static boolean maybeRenameParentConstructorCall(
      boolean shouldProcessViews, MethodNode method, ClassNode clsNode) {
    if (!shouldProcessViews) {
      return false;
    }

    for (Iterator<AbstractInsnNode> it = method.instructions.iterator(); it.hasNext(); ) {
      AbstractInsnNode insnNode = it.next();
      if (insnNode.getOpcode() == Opcodes.INVOKESPECIAL
          && AsmMethodUtils.isConstructorName(((MethodInsnNode) insnNode).name)
          // Only do if this is super constructor call: we could
          // be calling a constructor of another object
          // for example through a new instruction.
          && ((MethodInsnNode) insnNode).owner.equals(clsNode.superName)) {
        String safeSuperClassName =
            ANDROID_CLASS_INAME_AND_SAFE_CLASS_INAME_MAP.get(clsNode.superName);
        if (safeSuperClassName != null) {
          ((MethodInsnNode) insnNode).owner = safeSuperClassName;
          return true;
        }
      }
    }

    return false;
  }