TreeWalkerBase<Node> (@NotNull TreeVisitor visitor, boolean allowLoading) { if (visitor.visitThread() == TreeVisitor.VisitThread.BGT) { return new BgtTreeWalker<>(visitor, background, foreground, node -> node.object) { @Override protected @Nullable Collection<Node> getChildren(@NotNull AsyncTreeModel.Node node) { return getChildrenForWalker(node, this, allowLoading); } }; } else { return new AbstractTreeWalker<>(visitor, node -> node.object) { @Override protected @Nullable Collection<Node> getChildren(@NotNull Node node) { return getChildrenForWalker(node, this, allowLoading); } }; } }