PsiExpression (PsiExpression expression, @NotNull TypeEvaluator evaluator) { final PsiExpression replaced = super.replace(expression, evaluator); // Replace the getter's return type: List -> ObservableList final PsiElement parent = replaced.getParent(); if (parent instanceof PsiReturnStatement returnStatement) { final PsiElement statementParent = returnStatement.getParent(); if (statementParent instanceof PsiCodeBlock codeBlock) { final PsiElement blockParent = codeBlock.getParent(); if (blockParent instanceof PsiMethod method) { final PsiTypeElement returnTypeElement = method.getReturnTypeElement(); if (returnTypeElement != null && myOriginalType.equals(method.getReturnType())) { final String text = JavaFxCommonNames.JAVAFX_COLLECTIONS_OBSERVABLE_LIST + "<" + myItemType.getCanonicalText() + ">"; final PsiTypeElement newReturnTypeElement = JavaPsiFacade.getInstance(myProject) .getElementFactory().createTypeElementFromText(text, method); final JavaCodeStyleManager javaCodeStyleManager = JavaCodeStyleManager.getInstance(myProject); javaCodeStyleManager.shortenClassReferences(returnTypeElement.replace(newReturnTypeElement)); } } } } return replaced; }