PsiExpression (PsiExpression collectionExpression) { if (collectionExpression instanceof PsiNewExpression) { final PsiDiamondType.DiamondInferenceResult diamondResolveResult = PsiDiamondTypeImpl.resolveInferredTypesNoCheck((PsiNewExpression)collectionExpression, collectionExpression); if (!diamondResolveResult.getInferredTypes().isEmpty()) { collectionExpression = PsiDiamondTypeUtil.expandTopLevelDiamondsInside(collectionExpression); } } else if (collectionExpression instanceof PsiMethodCallExpression) { final PsiType currentType = collectionExpression.getType(); if (currentType == null) { return null; } final PsiExpression copiedExpression = (PsiExpression) collectionExpression.copy(); final PsiType newType = copiedExpression.getType(); if (!currentType.equals(newType)) { final PsiExpression newExpression = AddTypeArgumentsFix.addTypeArguments(copiedExpression, currentType); return newExpression == null ? collectionExpression : newExpression; } } return collectionExpression; }