@Override public void visitReferenceExpression(PsiReferenceExpression expression) { if (argumentsContainCatchParameter || !visited.add(expression)) { return; } super.visitReferenceExpression(expression); final PsiElement target = expression.resolve(); if (!parameter.equals(target)) { if (target instanceof PsiLocalVariable) { final PsiLocalVariable variable = (PsiLocalVariable) target; 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)) { return true; } final PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression) grandParent; final PsiExpressionList argumentList = methodCallExpression.getArgumentList(); final PsiExpression[] arguments = argumentList.getExpressions(); for (PsiExpression argument : arguments) { argument.accept(ReferenceFinder.this); } return true; }); final PsiExpression initializer = variable.getInitializer(); if (initializer != null) { initializer.accept(this); } } return; } if (ignoreGetMessage) { argumentsContainCatchParameter = true; } else { final PsiElement parent = expression.getParent(); if (parent instanceof PsiReferenceExpression) { final PsiElement grandParent = parent.getParent(); if (grandParent instanceof PsiMethodCallExpression) { return; } } argumentsContainCatchParameter = true; } }