void (@NotNull PsiReferenceExpression expression) { if (argumentsContainCatchParameter || !visited.add(expression)) { return; } super.visitReferenceExpression(expression); final PsiElement target = expression.resolve(); if (parameter.equals(target)) { if (!ignoreGetMessage) { final PsiElement parent = expression.getParent(); if (parent instanceof PsiReferenceExpression) { final PsiElement grandParent = parent.getParent(); if (grandParent instanceof PsiMethodCallExpression) { return; } } } argumentsContainCatchParameter = true; } else { if (target instanceof PsiLocalVariable variable) { final Query<PsiReference> query = ReferencesSearch.search(variable, variable.getUseScope(), false); query.forEach(reference -> { final PsiElement element = reference.getElement(); final PsiElement parent = PsiTreeUtil.skipParentsOfType(element, PsiParenthesizedExpression.class); if (!(parent instanceof PsiReferenceExpression)) { return true; } final PsiElement grandParent = parent.getParent(); if (!(grandParent instanceof PsiMethodCallExpression methodCallExpression)) { return true; } final PsiExpressionList argumentList = methodCallExpression.getArgumentList(); final PsiExpression[] arguments = argumentList.getExpressions(); for (PsiExpression argument : arguments) { argument.accept(this); } return true; }); final PsiExpression initializer = variable.getInitializer(); if (initializer != null) { initializer.accept(this); } } else if (target instanceof PsiPatternVariable) { final PsiElement pattern = target.getParent(); if (!(pattern instanceof PsiTypeTestPattern)) { return; } final PsiElement parent = JavaPsiPatternUtil.skipParenthesizedPatternUp(pattern.getParent()); if (parent instanceof PsiInstanceOfExpression instanceOfExpression) { instanceOfExpression.getOperand().accept(this); } else if (parent instanceof PsiCaseLabelElementList && parent.getParent() instanceof PsiSwitchLabelStatementBase label) { PsiSwitchBlock switchBlock = label.getEnclosingSwitchBlock(); if (switchBlock != null) { PsiExpression selector = switchBlock.getExpression(); if (selector != null) { selector.accept(this); } } } } } }