private static boolean matchesExpectedType(LookupElement item, PsiType type) {
    Object object = item.getObject();
    if (object instanceof PsiClass) return false;
    if (PsiTypes.voidType().equals(type)) return object instanceof PsiMethod;

    PsiType itemType = JavaCompletionUtil.getLookupElementType(item);
    return itemType != null && type.isAssignableFrom(itemType);
  }
private static boolean matchesExpectedType(LookupElement item, PsiType type)