UExpression (PsiMethod method) { UMethod uMethod = UastContextKt.toUElement(method, UMethod.class); if (uMethod == null) return null; final UExpression uBody = uMethod.getUastBody(); if (!(uBody instanceof UBlockExpression)) return null; final List<UExpression> expressions = ((UBlockExpression)uBody).getExpressions(); final UExpression singleExpression = ContainerUtil.getOnlyItem(expressions); if (singleExpression == null) return null; if (!(singleExpression instanceof UReturnExpression uReturnExpression)) return null; final UExpression returnValue = uReturnExpression.getReturnExpression(); if (returnValue == null) return null; if (returnValue instanceof UReferenceExpression referenceExpression) { final UElement uElement = UResolvableKt.resolveToUElement(referenceExpression); final UField uField = ObjectUtils.tryCast(uElement, UField.class); if (uField != null && uField.isFinal()) { return uField.getUastInitializer(); } return ObjectUtils.tryCast(uElement, UExpression.class); } else if (returnValue instanceof UCallExpression uCallExpression) { final PsiMethod psiMethod = uCallExpression.resolve(); if (psiMethod == null) return null; return getReturnedExpression(psiMethod); } return returnValue; }