private static int getChildIndex(PsiElement[] children, PsiElement child) {
    // do not use equals() since some smart-heads are used to override it (e.g. JspxImportStatementImpl)
    int i = ArrayUtil.indexOfIdentity(children, child);
    if (i != -1) {
      return i;
    }
    LOG.error("Cannot find element among its parent' children." +
              " element: '" + child + "';" +
              " parent: '" + child.getParent() + "';" +
              " children: " + Arrays.asList(children) + "; " +
              " file:" + child.getContainingFile());
    return -1;
  }
private static int getChildIndex(PsiElement[] children, PsiElement child)