The LegacyTermsEnum correctly seeks to the first Term/TermRef but as the deprec TermEnum still iterates after the last term, the TermsEnum returns all terms from all later fields, too. So seek() and next() should also do a field==Term.field() comparison and set SeekStatus/return value correctly.
Nice catch – I'll open a new issue & fix.
Also (you see it because missing @Override): The new abstract Enums have no close method / not implement java.io.Closeable, so the underlying old enums are never closed by client code. Shouldn't all the enum classes not also be Closeable, even when the new Codec API current would implement these as a no-op for core classes. But maybe someone creates a codec that needs close?
I actually intentionally left .close() out of all *Enums.
First, to strongly bias impls from doing such costly things that close
is necessary. These enums are used in hotspots during searching.
Second, because for Lucene's core impls, close() is [almost?] always a
no-op: these impls are very lightweight.
Third, because in Lucene we don't consistently close the enums we
pull, today, so we have confusion (there have been posts to java-user
about this – "do I need to close the TermEnum/TermDocs"). I'd rather
not add a "close" that for all core impls is a no-op and so Lucene
doesn't have to call close.
Fourth, because it complicates our impls if we really must close
whenever we pull a enum – eg our Scorers pull enums today, but never