boolean (PsiExpression expression) { expression = PsiUtil.skipParenthesizedExprDown(expression); if (expression instanceof PsiNewExpression newExpression) { PsiExpressionList argumentList = newExpression.getArgumentList(); if (argumentList != null && argumentList.isEmpty() && newExpression.getAnonymousClass() == null) { PsiClassType type = ObjectUtils.tryCast(expression.getType(), PsiClassType.class); if (type == null) return false; PsiClass aClass = type.resolve(); if (aClass == null) return false; String qualifiedName = aClass.getQualifiedName(); if (qualifiedName == null || !qualifiedName.startsWith("java.util.")) return false; return com.intellij.psi.util.InheritanceUtil.isInheritor(aClass, CommonClassNames.JAVA_UTIL_COLLECTION) || com.intellij.psi.util.InheritanceUtil.isInheritor(aClass, CommonClassNames.JAVA_UTIL_MAP); } } if (expression instanceof PsiMethodCallExpression call) { @NonNls String name = call.getMethodExpression().getReferenceName(); PsiExpressionList argumentList = call.getArgumentList(); if(name != null && name.startsWith("new") && argumentList.isEmpty()) { PsiMethod method = call.resolveMethod(); if(method != null && method.getParameterList().isEmpty()) { PsiClass aClass = method.getContainingClass(); if(aClass != null) { String qualifiedName = aClass.getQualifiedName(); if (qualifiedName != null && GUAVA_UTILITY_CLASSES.contains(qualifiedName)) { return true; } } } } } return isCustomizedEmptyCollectionInitializer(expression); }