void (boolean acceptMethods, Consumer<? super LookupElement> results, boolean isExpectedTypeMember, PsiClass origClass, Collection<? extends PsiElement> declarations) { for (final PsiElement result : declarations) { if (result instanceof PsiMember member && !(result instanceof PsiClass)) { if (member instanceof PsiMethod method && method.isConstructor()) { PsiClass aClass = member.getContainingClass(); if (aClass == null || aClass.hasModifierProperty(PsiModifier.ABSTRACT)) continue; PsiClass enclosingClass = aClass.hasModifierProperty(PsiModifier.STATIC) ? null : aClass.getContainingClass(); if (enclosingClass != null && !InheritanceUtil.hasEnclosingInstanceInScope(enclosingClass, myPlace, true, false)) { continue; } // For parameterized class constructors, we add a diamond. Do not suggest constructors for parameterized classes // in Java 6 or older when diamond was not supported if (aClass.getTypeParameters().length > 0 && !PsiUtil.isLanguageLevel7OrHigher(myPlace)) continue; // Constructor type parameters aren't supported yet if (method.getTypeParameters().length > 0) continue; } else if (!(member.hasModifierProperty(PsiModifier.STATIC))) { continue; } if (!(result instanceof PsiField) && !(result instanceof PsiMethod)) continue; if (result instanceof PsiField && !member.hasModifierProperty(PsiModifier.FINAL)) continue; if (result instanceof PsiMethod && (!acceptMethods || myPlaceMethods.contains(result))) continue; if (JavaCompletionUtil.isInExcludedPackage(member, false) || myImportedStatically.contains(member)) continue; if (!JavaPsiFacade.getInstance(myPlace.getProject()).getResolveHelper().isAccessible(member, myPlace, null)) { continue; } final LookupElement item = result instanceof PsiMethod method ? createMethodElement(method, origClass) : createFieldElement((PsiField)result, origClass); if (item != null) { item.putUserData(EXPECTED_TYPE_MEMBER, isExpectedTypeMember); results.consume(AutoCompletionPolicy.NEVER_AUTOCOMPLETE.applyPolicy(item)); } } } }