code: public UnknownGenericException rethrowWithType(final Class<?> type) {
          final boolean sameType = contextType != null && contextType.equals(type);
          if (!sameType && contextType != null) {
              // not allow changing type if it's already set
              throw new IllegalStateException("Context type can't be changed");
          }
          return sameType ? this : new UnknownGenericException(type, genericName, genericSource, this);
      }
docs: Throw more specific exception.
  
  @param type context type
  @return new exception if type is different, same exception instance if type is the same