PsiElement (PsiElement namedElement, PsiElement element) { if (element instanceof PsiReferenceExpression refExpr) { PsiElement parent = refExpr.getParent(); if (parent instanceof PsiAssignmentExpression && refExpr.equals(((PsiAssignmentExpression)parent).getLExpression())) { return ((PsiAssignmentExpression)parent).getOperationTokenType() == JavaTokenType.EQ ? ((PsiAssignmentExpression)parent).getRExpression() : parent; } else { if (namedElement instanceof PsiParameter) { //filter usages in super method calls PsiElement gParent = refExpr.getParent().getParent(); if (gParent instanceof PsiMethodCallExpression) { if (!canInvertReferenceElement(((PsiMethodCallExpression)gParent).getMethodExpression(), true)) { return null; } } } return refExpr; } } return null; }