handleReflectionException

Handle the given reflection exception.

Should only be called if no checked exception is expected to be thrown by a target method, or if an error occurs while accessing a method or field.

Throws the underlying RuntimeException or Error in case of an InvocationTargetException with such a root cause. Throws an IllegalStateException with an appropriate message or UndeclaredThrowableException otherwise.

Parameters

ex

the reflection exception to handle