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 ) ; }
Throw more specific exception .