void (@NotNull PsiType type, @NotNull PsiTypeVisitor<? extends PsiType> visitor, @NotNull Project project, @NotNull Set<? super PsiType> set, @NotNull Set<? super PsiType> visited) { if (!visited.add(type)) return; if (type instanceof PsiPrimitiveType) { if (type.equals(PsiTypes.booleanType()) || type.equals(PsiTypes.voidType()) || type.equals(PsiTypes.nullType())) return; Stack<PsiType> stack = new Stack<>(); for (int i = PRIMITIVE_TYPES.length - 1; !PRIMITIVE_TYPES[i].equals(type); i--) { stack.push(PRIMITIVE_TYPES[i]); } while(!stack.empty()) { processType(stack.pop(), visitor, set); } } else{ PsiManager manager = PsiManager.getInstance(project); GlobalSearchScope resolveScope = type.getResolveScope(); if (resolveScope == null) resolveScope = GlobalSearchScope.allScope(project); PsiClassType objectType = PsiType.getJavaLangObject(manager, resolveScope); processType(objectType, visitor, set); if (type instanceof PsiClassType) { for (PsiType superType : type.getSuperTypes()) { processType(superType, visitor, set); processAllSuperTypes(superType, visitor, project, set, visited); } } } }