ReturnModel (@NotNull PsiReturnStatement statement) { PsiExpression value = statement.getReturnValue(); if (value == null) return new ReturnModel(statement, PsiTypes.voidType()); if (ExpressionUtils.nonStructuralChildren(value).anyMatch(c -> c instanceof PsiFunctionalExpression)) return null; PsiType type = RefactoringChangeUtil.getTypeByExpression(value); if (type == null || type instanceof PsiClassType && ((PsiClassType)type).resolve() == null) return null; return new ReturnModel(statement, type, getLeastValueType(value, type)); }