private void findTreeForStub(StubBuilder builder, ASTNode tree, final Iterator<StubElement<?>> stubs) {
    final IElementType type = tree.getElementType();

    if (type instanceof IStubElementType && ((IStubElementType<?, ?>)type).shouldCreateStub(tree)) {
      if (!stubs.hasNext()) {
        LOG.error("Stub mismatch, " + type);
      }
      final StubElement<?> curStub = stubs.next();
      myNodeToStubs.put(tree, curStub);
    }


    for (ASTNode node : tree.getChildren(null)) {
      if (!builder.skipChildProcessingWhenBuildingStubs(tree, node)) {
        findTreeForStub(builder, node, stubs);
      }
    }
  }
private void findTreeForStub(StubBuilder builder, ASTNode tree, final Iterator<StubElement<?>> stubs)