< prev index next >

src/java.base/share/classes/java/lang/reflect/Method.java

Print this page
rev 56290 : 8230648: Replace @exception tag with @throws in java.base
Summary: Minor coding style update of javadoc tag in any file in java.base
Reviewed-by: prappo, lancea


 507      * overriding based on the runtime type of the target object may occur.
 508      *
 509      * <p>If the underlying method is static, the class that declared
 510      * the method is initialized if it has not already been initialized.
 511      *
 512      * <p>If the method completes normally, the value it returns is
 513      * returned to the caller of invoke; if the value has a primitive
 514      * type, it is first appropriately wrapped in an object. However,
 515      * if the value has the type of an array of a primitive type, the
 516      * elements of the array are <i>not</i> wrapped in objects; in
 517      * other words, an array of primitive type is returned.  If the
 518      * underlying method return type is void, the invocation returns
 519      * null.
 520      *
 521      * @param obj  the object the underlying method is invoked from
 522      * @param args the arguments used for the method call
 523      * @return the result of dispatching the method represented by
 524      * this object on {@code obj} with parameters
 525      * {@code args}
 526      *
 527      * @exception IllegalAccessException    if this {@code Method} object
 528      *              is enforcing Java language access control and the underlying
 529      *              method is inaccessible.
 530      * @exception IllegalArgumentException  if the method is an
 531      *              instance method and the specified object argument
 532      *              is not an instance of the class or interface
 533      *              declaring the underlying method (or of a subclass
 534      *              or implementor thereof); if the number of actual
 535      *              and formal parameters differ; if an unwrapping
 536      *              conversion for primitive arguments fails; or if,
 537      *              after possible unwrapping, a parameter value
 538      *              cannot be converted to the corresponding formal
 539      *              parameter type by a method invocation conversion.
 540      * @exception InvocationTargetException if the underlying method
 541      *              throws an exception.
 542      * @exception NullPointerException      if the specified object is null
 543      *              and the method is an instance method.
 544      * @exception ExceptionInInitializerError if the initialization
 545      * provoked by this method fails.
 546      */
 547     @CallerSensitive
 548     @ForceInline // to ensure Reflection.getCallerClass optimization
 549     @HotSpotIntrinsicCandidate
 550     public Object invoke(Object obj, Object... args)
 551         throws IllegalAccessException, IllegalArgumentException,
 552            InvocationTargetException
 553     {
 554         if (!override) {
 555             Class<?> caller = Reflection.getCallerClass();
 556             checkAccess(caller, clazz,
 557                         Modifier.isStatic(modifiers) ? null : obj.getClass(),
 558                         modifiers);
 559         }
 560         MethodAccessor ma = methodAccessor;             // read volatile
 561         if (ma == null) {
 562             ma = acquireMethodAccessor();
 563         }
 564         return ma.invoke(obj, args);




 507      * overriding based on the runtime type of the target object may occur.
 508      *
 509      * <p>If the underlying method is static, the class that declared
 510      * the method is initialized if it has not already been initialized.
 511      *
 512      * <p>If the method completes normally, the value it returns is
 513      * returned to the caller of invoke; if the value has a primitive
 514      * type, it is first appropriately wrapped in an object. However,
 515      * if the value has the type of an array of a primitive type, the
 516      * elements of the array are <i>not</i> wrapped in objects; in
 517      * other words, an array of primitive type is returned.  If the
 518      * underlying method return type is void, the invocation returns
 519      * null.
 520      *
 521      * @param obj  the object the underlying method is invoked from
 522      * @param args the arguments used for the method call
 523      * @return the result of dispatching the method represented by
 524      * this object on {@code obj} with parameters
 525      * {@code args}
 526      *
 527      * @throws    IllegalAccessException    if this {@code Method} object
 528      *              is enforcing Java language access control and the underlying
 529      *              method is inaccessible.
 530      * @throws    IllegalArgumentException  if the method is an
 531      *              instance method and the specified object argument
 532      *              is not an instance of the class or interface
 533      *              declaring the underlying method (or of a subclass
 534      *              or implementor thereof); if the number of actual
 535      *              and formal parameters differ; if an unwrapping
 536      *              conversion for primitive arguments fails; or if,
 537      *              after possible unwrapping, a parameter value
 538      *              cannot be converted to the corresponding formal
 539      *              parameter type by a method invocation conversion.
 540      * @throws    InvocationTargetException if the underlying method
 541      *              throws an exception.
 542      * @throws    NullPointerException      if the specified object is null
 543      *              and the method is an instance method.
 544      * @throws    ExceptionInInitializerError if the initialization
 545      * provoked by this method fails.
 546      */
 547     @CallerSensitive
 548     @ForceInline // to ensure Reflection.getCallerClass optimization
 549     @HotSpotIntrinsicCandidate
 550     public Object invoke(Object obj, Object... args)
 551         throws IllegalAccessException, IllegalArgumentException,
 552            InvocationTargetException
 553     {
 554         if (!override) {
 555             Class<?> caller = Reflection.getCallerClass();
 556             checkAccess(caller, clazz,
 557                         Modifier.isStatic(modifiers) ? null : obj.getClass(),
 558                         modifiers);
 559         }
 560         MethodAccessor ma = methodAccessor;             // read volatile
 561         if (ma == null) {
 562             ma = acquireMethodAccessor();
 563         }
 564         return ma.invoke(obj, args);


< prev index next >