boolean (TerminalBlock tb) { PsiMethodCallExpression call = tb.getSingleMethodCall(); if (call == null || tb.getVariable().getType() instanceof PsiPrimitiveType) return false; if (!ExpressionUtils.isReferenceTo(call.getArgumentList().getExpressions()[0], tb.getVariable())) return false; if (!"add".equals(call.getMethodExpression().getReferenceName())) return false; PsiExpression qualifierExpression = call.getMethodExpression().getQualifierExpression(); if (qualifierExpression == null || qualifierExpression instanceof PsiThisExpression) { PsiMethod method = PsiTreeUtil.getParentOfType(call, PsiMethod.class); return method == null || !method.getName().equals("addAll"); } return !(qualifierExpression instanceof PsiMethodCallExpression); }