Creates a new instance using the class.  overload this to handle more complex constructors
324534
protected T createInstance() {
		try {
			return targetClass.newInstance();
		} catch (InstantiationException e) {
			throw new RuntimeException(e);
		} catch (IllegalAccessException e) {
			throw new RuntimeException(e);
		}
	}
103680
def create(self, instance):
        
        with self.flushing():
            if instance.id is None:
                instance.id = self.new_object_id()
            self.session.add(instance)
        return instance
573659
public <T> void newInstance(Local<T> target, MethodId<T, Void> constructor, Local<?>... args) {
        if (target == null) {
            throw new IllegalArgumentException();
        }
        addInstruction(new ThrowingCstInsn(Rops.NEW_INSTANCE, sourcePosition,
                RegisterSpecList.EMPTY, catches, constructor.declaringType.constant));
        moveResult(target, true);
        invokeDirect(constructor, null, target, args);
    }
970100
function newInstance(extend) {
  return (initialValues = {}) => {
    const model = {};
    const publicAPI = {};
    extend(publicAPI, model, initialValues);
    return Object.freeze(publicAPI);
  };
}
68158
def create(cls, config_file=None):
        
        if cls.instance is None:
            cls.instance = cls(config_file)

            # Load config file, possibly overwriting the defaults
            cls.instance.load_ini()

        if config_file and config_file != cls.instance.config_file:
            raise RuntimeError("Configuration initialized a second time with a different file!")

        return cls.instance
30347
static Object newInstance(String className, ClassLoader cl,
                                      boolean doFallback)
        throws ConfigurationError
    {
        // assert(className != null);
        try{
            Class providerClass = findProviderClass(className, cl, doFallback);
            Object instance = providerClass.newInstance();
            debugPrintln("created new instance of " + providerClass +
                   " using ClassLoader: " + cl);
            return instance;
        } catch (ClassNotFoundException x) {
            throw new ConfigurationError(
                "Provider " + className + " not found", x);
        } catch (Exception x) {
            throw new ConfigurationError(
                "Provider " + className + " could not be instantiated: " + x,
                x);
        }
    }
655136
def new_instance(self, name):
        
        ist = lib.EnvCreateRawInstance(self._env, self._cls, name.encode())
        if ist == ffi.NULL:
            raise CLIPSError(self._env)

        return Instance(self._env, ist)
1318718
@SuppressWarnings("unchecked")
	public T newInstance(ClassLoader classLoader) {
		try {
			return (T) compile(classLoader).getConstructor(Object[].class)
					// Because Constructor.newInstance(Object... initargs), we need to load
					// references into a new Object[], otherwise it cannot be compiled.
					.newInstance(new Object[] {references});
		} catch (Exception e) {
			throw new RuntimeException(
				"Could not instantiate generated class '" + className + "'", e);
		}
	}
20557
public static Object newInstanceFromName(Object enclosingObject, String className, ClassLoader classLoader) {
		try {
			Class<?> clazz = Class.forName(className, false, classLoader);
			for (Constructor<?> c : clazz.getConstructors()) {
				Class<?>[] parameterTypes = c.getParameterTypes();
				if (parameterTypes.length == 0) {
					return c.newInstance();
				} else if (parameterTypes.length == 1 && enclosingObject != null && parameterTypes[0].equals(enclosingObject.getClass())) {
					return c.newInstance(enclosingObject);
				}
			}
			return clazz.newInstance();
		} catch (Exception e) {
			String m = "Couldn't create instance from name " + className + " (" + e.getMessage() + ")";
			LOG.error(m, e);
			throw new RuntimeException(m);
		}
	}
604665
public <T> T createInstance(Class<T> type) {
        try {
            return type.newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            throw new IllegalArgumentException("Cannot create instance of class " + type.getName(), e);
        }
    }
685578
def create_instance(self, parent):
        """"""
        self.kwargs['instantiate'] = True
        self.kwargs['parent'] = parent
        instance = self.cls(*self.args, **self.kwargs)
        instance._field_seqno = self._field_seqno
        return instance
752969
def instantiate(self, cls=None):
        
        if cls is None:
            cls = self.cls
        if cls is None:
            raise TypeError("cls must a class")
        return cls.create(*self.args, **self.kwargs)
808926
private E createUsingConstructor() throws CheckedAnalysisException {
        Constructor<E> constructor;
        try {
            constructor = databaseClass.getConstructor(new Class[0]);
        } catch (NoSuchMethodException e) {
            return null;
        }

        try {
            return constructor.newInstance(new Object[0]);
        } catch (InstantiationException e) {
            throw new CheckedAnalysisException("Could not create " + databaseClass.getName(), e);
        } catch (IllegalAccessException e) {
            throw new CheckedAnalysisException("Could not create " + databaseClass.getName(), e);
        } catch (InvocationTargetException e) {
            throw new CheckedAnalysisException("Could not create " + databaseClass.getName(), e);
        }
    }
1368431
public static <T> T newInstance(Class<?> aClass, Object... initargs) 
	throws SetupException
	{
		Class<?>[] parameterTypes = null;
		
		if(initargs != null && initargs.length > 0)
		{
			parameterTypes = new Class<?>[initargs.length];
			
			for (int i = 0; i < initargs.length; i++)
			{
				if(initargs[i] == null)
					continue; //skip
				
				parameterTypes[i] = initargs[i].getClass();
			}
		}
		
		return newInstance(aClass,parameterTypes,initargs);
	}
149910
def createInstance(self, codec=None):
        
        if type(self.klass) is type:
            return self.klass.__new__(self.klass)

        return self.klass()
108940
public Object newInstance( String name, Object[] params, String[] types ) throws ClassLoaderException {
        Class<?> clazz;
        try {
            clazz = loadClass(name);
        } catch (ClassNotFoundException e) {
            throw new ClassLoaderException(e);
        }
        
        List<Class> paramTypes = new ArrayList<Class>();
        
        if ( types != null ) {
            for( String type: types ) {
                try {
                    paramTypes.add( loadClass(type) );
                } catch (ClassNotFoundException e) {
                    throw new ClassLoaderException(e);
                }
            }
        } else if ( params != null ) {
            for ( Object param: params ) {
                paramTypes.add( param.getClass() );
            }
        } 
        
        if ( params != null ) {
            Constructor<?> constructor;
            try {
                constructor = clazz.getConstructor( paramTypes.toArray( new Class[paramTypes.size()] ) );
            } catch (SecurityException e) {
                throw new ClassLoaderException("Private constructor for " + clazz.getSimpleName(), e);
            } catch (NoSuchMethodException e) {
                throw new ClassLoaderException("No such constructor for " + clazz.getSimpleName(), e);
            } catch (Exception e) {
                throw new ClassLoaderException("Attempted to access constructor for " + clazz.getSimpleName(), e);
            }
            
            try {
                return constructor.newInstance(params);
            } catch (IllegalArgumentException e) {
                throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
            } catch (InstantiationException e) {
                throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
            } catch (IllegalAccessException e) {
                throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
            } catch (InvocationTargetException e) {
                throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
            } catch (Exception e) {
                throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
            }

        } else {
            Constructor<?> constructor;
            try {
                constructor = clazz.getConstructor();
            } catch (SecurityException e) {
                throw new ClassLoaderException("Private constructor for " + clazz.getSimpleName(),e);
            } catch (NoSuchMethodException e) {
                throw new ClassLoaderException("No such constructor for " + clazz.getSimpleName(),e);
            } catch (Exception e) {
                throw new ClassLoaderException("Attempted to access constructor for " + clazz.getSimpleName(), e);
            }
            
            try {
                return constructor.newInstance();
            } catch (IllegalArgumentException e) {
                throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
            } catch (InstantiationException e) {
                throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
            } catch (IllegalAccessException e) {
                throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
            } catch (InvocationTargetException e) {
                throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
            } catch (Exception e) {
                throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
            }
        }
    }
1001604
@SuppressWarnings("unchecked")
  public static <T> T newInstance(Class<T> theClass, Configuration conf,
      boolean supportJobConf) {
    T result;
    try {
      Constructor<T> meth = (Constructor<T>) CONSTRUCTOR_CACHE.get(theClass);
      if (meth == null) {
        meth = theClass.getDeclaredConstructor(EMPTY_ARRAY);
        meth.setAccessible(true);
        CONSTRUCTOR_CACHE.put(theClass, meth);
      }
      result = meth.newInstance();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
    setConf(result, conf, supportJobConf);
    return result;
  }