boolean (@NotNull LookupElement item) { TypedLookupItem typed = item.as(TypedLookupItem.CLASS_CONDITION_KEY); PsiType itemType = typed == null ? null : typed.getType(); return itemType != null && Arrays.stream(myExpectedTypes) .map(ExpectedTypeInfo::getType) .anyMatch(type -> !isTooGeneric(type) && type.isAssignableFrom(itemType)); }