boolean (PsiExpression initializer) { if (!(initializer instanceof PsiNewExpression newExpression)) { return ConstructionUtils.isEmptyCollectionInitializer(initializer); } final PsiExpressionList argumentList = newExpression.getArgumentList(); if (argumentList == null) { return false; } PsiMethod ctor = newExpression.resolveMethod(); if (ctor == null) return true; PsiParameter[] parameters = ctor.getParameterList().getParameters(); final PsiExpression[] arguments = argumentList.getExpressions(); if (ctor.isVarArgs() && arguments.length >= parameters.length) { return false; } for (PsiParameter parameter : parameters) { PsiType type = parameter.getType(); if (CollectionUtils.isCollectionClassOrInterface(type)) { return false; } if (type instanceof PsiArrayType && !(type instanceof PsiEllipsisType)) { return false; } } return true; }