code: public static Optional<ElementKind> resolveKind(Element element) {
          if (element != null) {
  
              try {
                  final ElementKind kind = element.getKind();
                  return Optional.of(kind);
              } catch (Exception e) {
                  // ignore and fall through to empty
              }
          }
          return Optional.empty();
      }
docs: The Java APT throws an internal exception {code com.sun.tools.javac.code.Symbol$CompletionFailure} if a class is missing from the classpath and {@link Element#getKind()} is called. This method
  handles exceptions when calling the getKind() method to avoid this scenario and should be used instead of {@link Element#getKind()}.
  
  @param element The element
  @return The kind if it is resolvable