static void migrateMemberOrVariableType(final PsiElement element, final Project project, PsiType migratedType) {
    try {
      migratedType = revalidateType(migratedType, project);
      final PsiTypeElement typeElement = JavaPsiFacade.getElementFactory(project).createTypeElement(migratedType);
      if (element instanceof PsiMethod) {
        final PsiTypeElement returnTypeElement = ((PsiMethod)element).getReturnTypeElement();
        if (returnTypeElement != null) {
          final PsiElement replaced = returnTypeElement.replace(typeElement);
          JavaCodeStyleManager.getInstance(project).shortenClassReferences(replaced);
        }
      }
      else if (element instanceof PsiVariable) {
        final PsiTypeElement varTypeElement = ((PsiVariable)element).getTypeElement();
        if (varTypeElement != null) {
          final PsiElement replaced = varTypeElement.replace(typeElement);
          JavaCodeStyleManager.getInstance(project).shortenClassReferences(replaced);
        }
      }
      else {
        LOG.error("Must not happen: " + element.getClass().getName());
      }
    }
    catch (IncorrectOperationException e) {
      LOG.error(e);
    }
  }
static void migrateMemberOrVariableType(final PsiElement element, final Project project, PsiType migratedType)