1 /* |
1 /* |
2 * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
109 } |
109 } |
110 |
110 |
111 /** |
111 /** |
112 * Package-private constructor used by ReflectAccess to enable |
112 * Package-private constructor used by ReflectAccess to enable |
113 * instantiation of these objects in Java code from the java.lang |
113 * instantiation of these objects in Java code from the java.lang |
114 * package via sun.reflect.LangReflectAccess. |
114 * package via jdk.internal.access.JavaLangReflectAccess. |
115 */ |
115 */ |
116 Constructor(Class<T> declaringClass, |
116 Constructor(Class<T> declaringClass, |
117 Class<?>[] parameterTypes, |
117 Class<?>[] parameterTypes, |
118 Class<?>[] checkedExceptions, |
118 Class<?>[] checkedExceptions, |
119 int modifiers, |
119 int modifiers, |
452 * in a {@link java.lang.Float Float}) |
452 * in a {@link java.lang.Float Float}) |
453 * |
453 * |
454 * @return a new object created by calling the constructor |
454 * @return a new object created by calling the constructor |
455 * this object represents |
455 * this object represents |
456 * |
456 * |
457 * @exception IllegalAccessException if this {@code Constructor} object |
457 * @throws IllegalAccessException if this {@code Constructor} object |
458 * is enforcing Java language access control and the underlying |
458 * is enforcing Java language access control and the underlying |
459 * constructor is inaccessible. |
459 * constructor is inaccessible. |
460 * @exception IllegalArgumentException if the number of actual |
460 * @throws IllegalArgumentException if the number of actual |
461 * and formal parameters differ; if an unwrapping |
461 * and formal parameters differ; if an unwrapping |
462 * conversion for primitive arguments fails; or if, |
462 * conversion for primitive arguments fails; or if, |
463 * after possible unwrapping, a parameter value |
463 * after possible unwrapping, a parameter value |
464 * cannot be converted to the corresponding formal |
464 * cannot be converted to the corresponding formal |
465 * parameter type by a method invocation conversion; if |
465 * parameter type by a method invocation conversion; if |
466 * this constructor pertains to an enum type. |
466 * this constructor pertains to an enum type. |
467 * @exception InstantiationException if the class that declares the |
467 * @throws InstantiationException if the class that declares the |
468 * underlying constructor represents an abstract class. |
468 * underlying constructor represents an abstract class. |
469 * @exception InvocationTargetException if the underlying constructor |
469 * @throws InvocationTargetException if the underlying constructor |
470 * throws an exception. |
470 * throws an exception. |
471 * @exception ExceptionInInitializerError if the initialization provoked |
471 * @throws ExceptionInInitializerError if the initialization provoked |
472 * by this method fails. |
472 * by this method fails. |
473 */ |
473 */ |
474 @CallerSensitive |
474 @CallerSensitive |
475 @ForceInline // to ensure Reflection.getCallerClass optimization |
475 @ForceInline // to ensure Reflection.getCallerClass optimization |
476 public T newInstance(Object ... initargs) |
476 public T newInstance(Object ... initargs) |