src/share/classes/java/lang/reflect/Constructor.java

Print this page




 478      * non-static context, the first argument to the constructor needs
 479      * to be the enclosing instance; see <i>The Java Language
 480      * Specification</i>, section 15.9.3.
 481      *
 482      * <p>If the required access and argument checks succeed and the
 483      * instantiation will proceed, the constructor's declaring class
 484      * is initialized if it has not already been initialized.
 485      *
 486      * <p>If the constructor completes normally, returns the newly
 487      * created and initialized instance.
 488      *
 489      * @param initargs array of objects to be passed as arguments to
 490      * the constructor call; values of primitive types are wrapped in
 491      * a wrapper object of the appropriate type (e.g. a {@code float}
 492      * in a {@link java.lang.Float Float})
 493      *
 494      * @return a new object created by calling the constructor
 495      * this object represents
 496      *
 497      * @exception IllegalAccessException    if this {@code Constructor} object
 498      *              enforces Java language access control and the underlying
 499      *              constructor is inaccessible.
 500      * @exception IllegalArgumentException  if the number of actual
 501      *              and formal parameters differ; if an unwrapping
 502      *              conversion for primitive arguments fails; or if,
 503      *              after possible unwrapping, a parameter value
 504      *              cannot be converted to the corresponding formal
 505      *              parameter type by a method invocation conversion; if
 506      *              this constructor pertains to an enum type.
 507      * @exception InstantiationException    if the class that declares the
 508      *              underlying constructor represents an abstract class.
 509      * @exception InvocationTargetException if the underlying constructor
 510      *              throws an exception.
 511      * @exception ExceptionInInitializerError if the initialization provoked
 512      *              by this method fails.
 513      */
 514     public T newInstance(Object ... initargs)
 515         throws InstantiationException, IllegalAccessException,
 516                IllegalArgumentException, InvocationTargetException
 517     {
 518         if (!override) {




 478      * non-static context, the first argument to the constructor needs
 479      * to be the enclosing instance; see <i>The Java Language
 480      * Specification</i>, section 15.9.3.
 481      *
 482      * <p>If the required access and argument checks succeed and the
 483      * instantiation will proceed, the constructor's declaring class
 484      * is initialized if it has not already been initialized.
 485      *
 486      * <p>If the constructor completes normally, returns the newly
 487      * created and initialized instance.
 488      *
 489      * @param initargs array of objects to be passed as arguments to
 490      * the constructor call; values of primitive types are wrapped in
 491      * a wrapper object of the appropriate type (e.g. a {@code float}
 492      * in a {@link java.lang.Float Float})
 493      *
 494      * @return a new object created by calling the constructor
 495      * this object represents
 496      *
 497      * @exception IllegalAccessException    if this {@code Constructor} object
 498      *              is enforcing Java language access control and the underlying
 499      *              constructor is inaccessible.
 500      * @exception IllegalArgumentException  if the number of actual
 501      *              and formal parameters differ; if an unwrapping
 502      *              conversion for primitive arguments fails; or if,
 503      *              after possible unwrapping, a parameter value
 504      *              cannot be converted to the corresponding formal
 505      *              parameter type by a method invocation conversion; if
 506      *              this constructor pertains to an enum type.
 507      * @exception InstantiationException    if the class that declares the
 508      *              underlying constructor represents an abstract class.
 509      * @exception InvocationTargetException if the underlying constructor
 510      *              throws an exception.
 511      * @exception ExceptionInInitializerError if the initialization provoked
 512      *              by this method fails.
 513      */
 514     public T newInstance(Object ... initargs)
 515         throws InstantiationException, IllegalAccessException,
 516                IllegalArgumentException, InvocationTargetException
 517     {
 518         if (!override) {