boolean (@NotNull PsiElement leaf) { PsiElement parent = leaf.getParent(); if (leaf instanceof PsiKeyword) { if (parent instanceof PsiExpression && hasUnresolvedRefsBefore(leaf, parent)) { return false; } } if (leaf.textMatches(PsiKeyword.TRUE) || leaf.textMatches(PsiKeyword.FALSE)) { return false; // boolean literal presence depends on expected types, which can be missing in red files } if (JavaLexer.isSoftKeyword(leaf.getText(), LanguageLevel.JDK_1_9) && !PsiJavaModule.MODULE_INFO_FILE.equals(leaf.getContainingFile().getName())) { return false; } return true; }