void (final Consumer<? super LookupElement> results) { if (!JavaCompletionContributor.IN_SWITCH_LABEL.accepts(myPlace)) return; PsiSwitchBlock block = Objects.requireNonNull(PsiTreeUtil.getParentOfType(myPlace, PsiSwitchBlock.class)); final Set<PsiField> fields = ReferenceExpressionCompletionContributor.findConstantsUsedInSwitch(block); final Set<PsiClass> classes = new HashSet<>(); for (PsiField field : fields) { ContainerUtil.addIfNotNull(classes, field.getContainingClass()); } for (PsiClass aClass : classes) { processMembers(element -> { //noinspection SuspiciousMethodCalls if (!fields.contains(element.getObject())) { results.consume(TailTypeDecorator.withTail(element, JavaTailTypes.forSwitchLabel(block))); } }, aClass, true, false); } }