public static boolean isJavaToken(@Nullable PsiElement element, @NotNull TokenSet types) {
    return element instanceof PsiJavaToken && types.contains(((PsiJavaToken)element).getTokenType());
  }
public static boolean isJavaToken(@Nullable PsiElement element, @NotNull TokenSet types)