boolean (PsiExpression initializer) { if (initializer == null) return false; return ExpressionUtils.nonStructuralChildren(initializer).allMatch( expr -> { if (OBJECT_CLONE.matches(expr)) return true; if (expr instanceof PsiNewExpression || expr instanceof PsiMethodCallExpression && ContractReturnValue.returnNew().equals(JavaMethodContractUtil.getNonFailingReturnValue( JavaMethodContractUtil.getMethodCallContracts((PsiMethodCallExpression)expr)))) { PsiMethod method = ((PsiCallExpression)expr).resolveMethod(); if (method != null && Mutability.getMutability(method).isUnmodifiable()) { // Probably we are expecting some exception when calling the modification method return false; } if (ignoreImpureConstructors) { return MutationSignature.fromCall((PsiCallExpression)expr).isPure(); } return true; } return false; }); }