boolean (@NotNull PsiMethod method, PsiElement element) { if (!method.getName().equals(CLONE_METHOD_NAME)) return false; PsiClass containingClass = method.getContainingClass(); if (containingClass == null || !CommonClassNames.JAVA_LANG_OBJECT.equals(containingClass.getQualifiedName())) { return false; } if (element instanceof PsiMethodReferenceExpression) { final PsiMethodReferenceExpression methodCallExpression = (PsiMethodReferenceExpression)element; final PsiExpression qualifierExpression = methodCallExpression.getQualifierExpression(); return qualifierExpression != null && qualifierExpression.getType() instanceof PsiArrayType; } if (!(element instanceof PsiMethodCallExpression)) return false; PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression)element; final PsiExpression qualifierExpression = methodCallExpression.getMethodExpression().getQualifierExpression(); return qualifierExpression != null && qualifierExpression.getType() instanceof PsiArrayType; }