void (@NotNull PsiClass outerClass, @NotNull PsiElementFactory elementFactory, @NotNull PsiMethodCallExpression callExpression) { PsiType nearestAccessibleType = PsiReflectionAccessUtil.nearestAccessibleType(myType); PsiTypeElement returnTypeElement = myMethod.getReturnTypeElement(); if (returnTypeElement != null) { returnTypeElement.replace(elementFactory.createTypeElement(nearestAccessibleType)); } if (myMethod.equals(callExpression.resolveMethod())) { PsiElement parent = callExpression.getParent(); if (parent instanceof PsiLocalVariable) { ((PsiLocalVariable)parent).getTypeElement().replace(elementFactory.createTypeElement(nearestAccessibleType)); } else { LOG.error("Unexpected psi parent type of call expression: " + parent.getClass().getCanonicalName()); } } }