T getTargetObject(Object candidate) {
* {@linkplain AopUtils#isAopProxy proxy}, the ultimate target of all
* nested proxies will be returned; otherwise, the {@code candidate}
* will be returned as is.
+ * NOTE: If the top-level proxy or a nested proxy is not backed by a
+ * {@linkplain org.springframework.aop.TargetSource#isStatic() static}
+ * {@link org.springframework.aop.TargetSource TargetSource}, invocation of
+ * this utility method may result in undesired behavior such as infinite
+ * recursion leading to a {@link StackOverflowError}.
+ * @param the type of the target object
* @param candidate the instance to check (potentially a Spring AOP proxy;
* never {@code null})
* @return the target object or the {@code candidate} (never {@code null})
* @throws IllegalStateException if an error occurs while unwrapping a proxy
* @see Advised#getTargetSource()
+ * @see org.springframework.aop.TargetSource#isStatic()
* @see org.springframework.aop.framework.AopProxyUtils#ultimateTargetClass
*/
@SuppressWarnings("unchecked")