@Contract("null -> null")
  public static IElementType getElementType(@Nullable PsiElement element) {
    return element == null ? null :
           element instanceof StubBasedPsiElement ? ((StubBasedPsiElement<?>)element).getElementType() :
           element instanceof PsiFile ? ((PsiFile)element).getFileElementType() :
           getElementType(element.getNode());
  }
@Contract("null -> null")
  public static IElementType getElementType(@Nullable PsiElement element)