public static <C> C tryInstantiate(Class<C> r, Class<?> c, Parameterization config) throws ClassInstantiationException {
    if(c == null) {
      throw new ClassInstantiationException("Trying to instantiate 'null' class!");
    }
    try {
      // Try a V3 parameterization class
      Parameterizer par = getParameterizer(c);
      if(par instanceof AbstractParameterizer) {
        return r.cast(((AbstractParameterizer) par).make(config));
      }
      // Try a default constructor.
      return r.cast(c.getConstructor().newInstance());
    }
    catch(InstantiationException | InvocationTargetException
        | IllegalAccessException | NoSuchMethodException e) {
      throw new ClassInstantiationException(e);
    }
  }
public static < C > C tryInstantiate ( Class < C > r , Class < ? > c , Parameterization config ) throws ClassInstantiationException { if ( c == null ) { throw new ClassInstantiationException ( "Trying to instantiate 'null' class!" ) ; } try { Parameterizer par = getParameterizer ( c ) ; if ( par instanceof AbstractParameterizer ) { return r . cast ( ( ( AbstractParameterizer ) par ) . make ( config ) ) ; } return r . cast ( c . getConstructor ( ) . newInstance ( ) ) ; } catch ( InstantiationException | InvocationTargetException | IllegalAccessException | NoSuchMethodException e ) { throw new ClassInstantiationException ( e ) ; } }
Instantiate a parameterizable class. When using this, consider using
{@link Parameterization#descend}!

@param <C> base type
@param r Base (restriction) class
@param c Class to instantiate
@param config Configuration to use for instantiation.
@return Instance
@throws ClassInstantiationException When a class cannot be instantiated.