private static Object processReturnType(Object proxy, Object target, Method method, Object retVal) {
        // Massage return value if necessary
        if (retVal != null && retVal == target && !RawTargetAccess.class.isAssignableFrom(method.getDeclaringClass())) {
            // Special case: it returned "this". Note that we can't help
            // if the target sets a reference to itself in another returned object.
            retVal = proxy;
        }
        Class<?> returnType = method.getReturnType();
        if (retVal == null && returnType != Void.TYPE && returnType.isPrimitive()) {
            throw new AopInvocationException(
                    "Null return value from advice does not match primitive return type for: " + method);
        }
        return retVal;
    }
private static Object processReturnType(Object proxy, Object target, Method method, Object retVal) {
        
        if (retVal != null && retVal == target && !RawTargetAccess.class.isAssignableFrom(method.getDeclaringClass())) {
            
            
            retVal = proxy;
        }
        Class<?> returnType = method.getReturnType();
        if (retVal == null && returnType != Void.TYPE && returnType.isPrimitive()) {
            throw new AopInvocationException(
                    "Null return value from advice does not match primitive return type for: " + method);
        }
        return retVal;
    }
private static Object processReturnType ( Object proxy , Object target , Method method , Object retVal ) { // Massage return value if necessary if ( retVal != null && retVal == target && ! RawTargetAccess . class . isAssignableFrom ( method . getDeclaringClass ( ) ) ) { // Special case: it returned "this". Note that we can't help // if the target sets a reference to itself in another returned object. retVal = proxy ; } Class < ? > returnType = method . getReturnType ( ) ; if ( retVal == null && returnType != Void . TYPE && returnType . isPrimitive ( ) ) { throw new AopInvocationException ( "Null return value from advice does not match primitive return type for: " + method ) ; } return retVal ; }
Process a return value. Wraps a return of {@code this} if necessary to be the
{@code proxy} and also verifies that {@code null} is not returned as a primitive.
Process a return value . Wraps a return of {