PsiExpression (PsiExpression expression, @NotNull TypeEvaluator evaluator) { PsiMethod method = PsiTreeUtil.getParentOfType(expression, PsiMethod.class); if (method != null) { PsiDocComment docComment = method.getDocComment(); if (docComment != null) { PsiDocTag docTag = docComment.findTagByName("return"); if (docTag != null) { docTag.delete(); } } } final PsiElement parent = expression.getParent(); if (parent instanceof PsiReturnStatement) { if (SideEffectChecker.mayHaveSideEffects(expression)) { List<PsiExpression> sideEffectExpressions = SideEffectChecker.extractSideEffectExpressions(expression); PsiStatement[] sideEffectStatements = StatementExtractor.generateStatements(sideEffectExpressions, expression); PsiElement grandParent = parent.getParent(); for (PsiStatement statement : sideEffectStatements) { grandParent.addBefore(statement, parent); } } PsiElementFactory factory = JavaPsiFacade.getElementFactory(expression.getProject()); final PsiReturnStatement replaced = (PsiReturnStatement)parent.replace(factory.createStatementFromText("return;", null)); if (UnnecessaryReturnInspection.isReturnRedundant(replaced, false, false, null)) { DeleteUnnecessaryStatementFix.deleteUnnecessaryStatement(replaced); } } return null; }