private static @Nullable PsiType getType(@NotNull PsiElement expression) {
    if (expression instanceof PsiExpression) {
      return ((PsiExpression)expression).getType();
    }
    else if (expression instanceof PsiVariable) {
      return ((PsiVariable)expression).getType();
    }
    else if (expression instanceof PsiMethod) {
      return ((PsiMethod)expression).getReturnType();
    }
    return null;
  }
private static @Nullable PsiType getType(@NotNull PsiElement expression)