@Override public void visitMethodCallExpression(GrMethodCallExpression grMethodCallExpression) { super.visitMethodCallExpression(grMethodCallExpression); final GrArgumentList args = grMethodCallExpression.getArgumentList(); if (args.getExpressionArguments().length != 1) { return; } if (PsiImplUtil.hasNamedArguments(args)) { return; } final GrExpression methodExpression = grMethodCallExpression.getInvokedExpression(); if (!(methodExpression instanceof GrReferenceExpression)) { return; } final GrReferenceExpression referenceExpression = (GrReferenceExpression) methodExpression; final String name = referenceExpression.getReferenceName(); if (!"get".equals(name)) { return; } final GrExpression qualifier = referenceExpression.getQualifierExpression(); if (qualifier == null || PsiUtil.isThisOrSuperRef(qualifier)) { return; } if (referenceExpression.getDotTokenType() == GroovyTokenTypes.mOPTIONAL_DOT) return; final PsiType type = qualifier.getType(); if (!InheritanceUtil.isInheritor(type, CommonClassNames.JAVA_UTIL_MAP)) { return; } registerMethodCallError(grMethodCallExpression); }
public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException { final GroovyResolveResult result = advancedResolve(); if (result.isInvokedOnProperty()) { final String name = GroovyPropertyUtils.getPropertyNameByAccessorName(newElementName); if (name != null) { newElementName = name; } } if (PsiUtil.isThisOrSuperRef(this)) return this; return handleElementRenameSimple(newElementName); }