spring-framework / org.springframework.util / ReflectionUtils / declaresException

declaresException

open static fun declaresException(method: Method, exceptionType: Class<*>): Boolean

Determine whether the given method explicitly declares the given exception or one of its superclasses, which means that an exception of that type can be propagated as-is within a reflective invocation.

Parameters

method - the declaring method

exceptionType - the exception to throw

Return
true if the exception can be thrown as-is; false if it needs to be wrapped