boolean (@NotNull PsiElement element) { if (!(element instanceof GrMethodCallExpression callExpression)) { return false; } if (ErrorUtil.containsError(element)) { return false; } final GrArgumentList argList = callExpression.getArgumentList(); final GrExpression[] arguments = argList.getExpressionArguments(); final GrExpression invokedExpression = callExpression.getInvokedExpression(); if (!(invokedExpression instanceof GrReferenceExpression referenceExpression)) { return false; } final GrExpression qualifier = referenceExpression.getQualifierExpression(); if (qualifier == null) { return false; } final IElementType referenceType = referenceExpression.getDotTokenType(); if (!GroovyTokenTypes.mDOT.equals(referenceType)) { return false; } final String methodName = referenceExpression.getReferenceName(); if ("getAt".equals(methodName)) { return arguments.length == 1; } if ("get".equals(methodName)) { final PsiType qualifierType = qualifier.getType(); if (!isMap(qualifierType)) { return false; } return arguments.length == 1; } else if ("setAt".equals(methodName)) { return arguments.length == 2; } else if ("put".equals(methodName)) { final PsiType qualifierType = qualifier.getType(); if (!isMap(qualifierType)) { return false; } return arguments.length == 2; } return false; }