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

Print this page




 300     /**
 301      * Returns an array of {@code Class} objects that represent
 302      * the types of the exceptions declared to be thrown
 303      * by the underlying method
 304      * represented by this {@code Method} object.  Returns an array of length
 305      * 0 if the method declares no exceptions in its {@code throws} clause.
 306      *
 307      * @return the exception types declared as being thrown by the
 308      * method this object represents
 309      */
 310     public Class<?>[] getExceptionTypes() {
 311         return (Class<?>[]) exceptionTypes.clone();
 312     }
 313 
 314     /**
 315      * Returns an array of {@code Type} objects that represent the
 316      * exceptions declared to be thrown by this {@code Method} object.
 317      * Returns an array of length 0 if the underlying method declares
 318      * no exceptions in its {@code throws} clause.
 319      *
 320      * <p>If an exception type is a parameterized type, the {@code Type}
 321      * object returned for it must accurately reflect the actual type
 322      * parameters used in the source code.
 323      *
 324      * <p>If an exception type is a type variable or a parameterized
 325      * type, it is created. Otherwise, it is resolved.
 326      *
 327      * @return an array of Types that represent the exception types
 328      *     thrown by the underlying method
 329      * @throws GenericSignatureFormatError
 330      *     if the generic method signature does not conform to the format
 331      *     specified in the Java Virtual Machine Specification, 3rd edition
 332      * @throws TypeNotPresentException if the underlying method's
 333      *     {@code throws} clause refers to a non-existent type declaration
 334      * @throws MalformedParameterizedTypeException if
 335      *     the underlying method's {@code throws} clause refers to a
 336      *     parameterized type that cannot be instantiated for any reason
 337      * @since 1.5
 338      */
 339       public Type[] getGenericExceptionTypes() {
 340           Type[] result;
 341           if (getGenericSignature() != null &&
 342               ((result = getGenericInfo().getExceptionTypes()).length > 0))
 343               return result;




 300     /**
 301      * Returns an array of {@code Class} objects that represent
 302      * the types of the exceptions declared to be thrown
 303      * by the underlying method
 304      * represented by this {@code Method} object.  Returns an array of length
 305      * 0 if the method declares no exceptions in its {@code throws} clause.
 306      *
 307      * @return the exception types declared as being thrown by the
 308      * method this object represents
 309      */
 310     public Class<?>[] getExceptionTypes() {
 311         return (Class<?>[]) exceptionTypes.clone();
 312     }
 313 
 314     /**
 315      * Returns an array of {@code Type} objects that represent the
 316      * exceptions declared to be thrown by this {@code Method} object.
 317      * Returns an array of length 0 if the underlying method declares
 318      * no exceptions in its {@code throws} clause.
 319      *




 320      * <p>If an exception type is a type variable or a parameterized
 321      * type, it is created. Otherwise, it is resolved.
 322      *
 323      * @return an array of Types that represent the exception types
 324      *     thrown by the underlying method
 325      * @throws GenericSignatureFormatError
 326      *     if the generic method signature does not conform to the format
 327      *     specified in the Java Virtual Machine Specification, 3rd edition
 328      * @throws TypeNotPresentException if the underlying method's
 329      *     {@code throws} clause refers to a non-existent type declaration
 330      * @throws MalformedParameterizedTypeException if
 331      *     the underlying method's {@code throws} clause refers to a
 332      *     parameterized type that cannot be instantiated for any reason
 333      * @since 1.5
 334      */
 335       public Type[] getGenericExceptionTypes() {
 336           Type[] result;
 337           if (getGenericSignature() != null &&
 338               ((result = getGenericInfo().getExceptionTypes()).length > 0))
 339               return result;