IntentionPreviewInfo (@NotNull Project project, @NotNull ProblemDescriptor previewDescriptor) { PsiMethod method = PsiTreeUtil.getParentOfType(previewDescriptor.getPsiElement(), PsiMethod.class); if (method == null) return IntentionPreviewInfo.EMPTY; PsiTypeElement returnTypeElement = method.getReturnTypeElement(); if (returnTypeElement == null) return IntentionPreviewInfo.EMPTY; PsiElementFactory factory = JavaPsiFacade.getElementFactory(project); PsiTypeElement typeElement = factory.createTypeElement(PsiTypes.voidType()); returnTypeElement.replace(typeElement); replaceReturnStatements(method); return IntentionPreviewInfo.DIFF; }