boolean (PsiFile contextFile, PsiElement context, Collection<? extends PsiClassType> expectedClassTypes, Consumer<? super PsiType> consumer) { for (final PsiClassType type : expectedClassTypes) { consumer.consume(type); final PsiClassType.ClassResolveResult baseResult = JavaCompletionUtil.originalize(type).resolveGenerics(); final PsiClass baseClass = baseResult.getElement(); if (baseClass == null) return false; final StatisticsInfo[] stats = StatisticsManager.getInstance().getAllValues(JavaStatisticsManager.getAfterNewKey(type)); for (final StatisticsInfo statisticsInfo : stats) { final String value = statisticsInfo.getValue(); if (value.startsWith(JavaStatisticsManager.CLASS_PREFIX)) { final String qname = value.substring(JavaStatisticsManager.CLASS_PREFIX.length()); final PsiClass psiClass = JavaPsiFacade.getInstance(contextFile.getProject()).findClass(qname, contextFile.getResolveScope()); if (psiClass != null && !PsiTreeUtil.isAncestor(contextFile, psiClass, true)) { PsiType toAdd = CodeInsightUtil.getSubTypeBySubClass(context, type, 0, false, baseClass, psiClass); if (toAdd != null) { consumer.consume(toAdd); } } } } } return true; }