boolean (@NotNull PsiElement variableNode) { if (variableNode instanceof PsiDocToken) return true; final PsiElement parent = variableNode.getParent(); if (isMemberSurroundedByClass(parent)) return true; final PsiElement grandParent = parent.getParent(); if (grandParent instanceof PsiCatchSection && parent instanceof PsiParameter) return true; if (grandParent instanceof PsiAnnotation && !(grandParent.getParent().getNextSibling() instanceof PsiErrorElement)) return true; if (grandParent instanceof PsiParameterList || grandParent instanceof PsiArrayInitializerMemberValue || grandParent instanceof PsiExpressionList || grandParent instanceof PsiCaseLabelElementList || grandParent instanceof PsiTypeParameterList || grandParent instanceof PsiResourceList || grandParent instanceof PsiResourceExpression || grandParent instanceof PsiArrayInitializerExpression) { return true; } if (grandParent instanceof PsiTypeElement) { final PsiElement greatGrandParent = grandParent.getParent(); if (greatGrandParent instanceof PsiReferenceParameterList || greatGrandParent instanceof PsiClass) return true; } if (grandParent instanceof PsiAnnotationParameterList && parent instanceof PsiNameValuePair) { return ((PsiNameValuePair)parent).getNameIdentifier() == variableNode; } return false; }