ExpectedTypeMatching (@NotNull LookupElement item) { if (item.getObject() instanceof PsiClass && !myConstructorPossible) { PsiType itemType = JavaCompletionUtil.getLookupElementType(item); if (itemType != null) { for (PsiType expectedClass : myExpectedClasses) { if (expectedClass.isAssignableFrom(itemType)) { return ExpectedTypeMatching.expected; } } } ExpectedTypeMatching byName = preferByMemberName(myExpectedMemberName, itemType); if (byName != ExpectedTypeMatching.normal) { return byName; } } return getExpectedTypeMatching(item, myExpectedTypes, myExpectedMemberName, myPosition); }