code: private static TypeMirror enclosingType(DeclaredType t) {
      TypeMirror enclosing = t.getEnclosingType();
      if (enclosing.getKind().equals(TypeKind.NONE)
          || t.asElement().getModifiers().contains(Modifier.STATIC)) {
        return null;
      }
      return enclosing;
    }
docs: Returns the type of the innermost enclosing instance, or null if there is none. This is the
  same as {@link DeclaredType#getEnclosingType()} except that it returns null rather than
  NoType for a static type. We need this because of
  <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=508222">this bug</a> whereby
  the Eclipse compiler returns a value for static classes that is not NoType.