boolean (@NotNull PsiElement variableNode) { final PsiElement parent = variableNode.getParent(); if (parent instanceof PsiLocalVariable localVariable) { if (localVariable instanceof PsiResourceVariable) return false; if (localVariable.getTypeElement().isInferredType()) return false; return true; } if (parent instanceof PsiField) return true; final PsiElement grandParent = parent.getParent(); if (grandParent instanceof PsiPolyadicExpression) return true; if (grandParent instanceof PsiExpressionStatement && isCompleteStatement((PsiExpressionStatement)grandParent)) { final PsiElement greatGrandParent = grandParent.getParent(); if (greatGrandParent instanceof PsiForStatement forStatement) { return forStatement.getInitialization() == grandParent || forStatement.getUpdate() == grandParent; } return greatGrandParent instanceof PsiCodeBlock || greatGrandParent instanceof PsiCodeFragment; } if (grandParent instanceof PsiReferenceList) { final PsiElement greatGrandParent = grandParent.getParent(); return !(greatGrandParent instanceof PsiClass) || ((PsiClass)greatGrandParent).getExtendsList() != grandParent || greatGrandParent instanceof PsiTypeParameter; } return false; }