code: @NullableDecl
    private Type getOwnerTypeIfPresent() {
      if (runtimeType instanceof ParameterizedType) {
        return ((ParameterizedType) runtimeType).getOwnerType();
      } else if (runtimeType instanceof Class<?>) {
        return ((Class<?>) runtimeType).getEnclosingClass();
      } else {
        return null;
      }
    }
docs: Returns the owner type of a {@link ParameterizedType} or enclosing class of a {@link Class}, or
  null otherwise.