I though about that, but from my understanding TreeFilters are in the responsibility of the API user, while it's the responsibility of the DirCacheIterator to decide what is relevant for the TreeWalk. I guess that in almost every case one will use DirCacheIterator(DirCache dc) constructor, so from API user's perspective current solution seems to be easier and safer.