LUCENE-5235: Update Javadocs to make it explicit that super.reset(), super.close() and super.end() must be called.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1525825 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2013-09-24 09:53:21 +00:00
parent 7df32026ec
commit 563182ab34
1 changed files with 13 additions and 2 deletions

View File

@ -164,6 +164,8 @@ public abstract class TokenStream extends AttributeSource implements Closeable {
* Additionally any skipped positions (such as those removed by a stopfilter) * Additionally any skipped positions (such as those removed by a stopfilter)
* can be applied to the position increment, or any adjustment of other * can be applied to the position increment, or any adjustment of other
* attributes where the end-of-stream value may be important. * attributes where the end-of-stream value may be important.
* <p>
* If you override this method, always call {@code super.end()}.
* *
* @throws IOException If an I/O error occurs * @throws IOException If an I/O error occurs
*/ */
@ -177,13 +179,22 @@ public abstract class TokenStream extends AttributeSource implements Closeable {
/** /**
* This method is called by a consumer before it begins consumption using * This method is called by a consumer before it begins consumption using
* {@link #incrementToken()}. * {@link #incrementToken()}.
* <p/> * <p>
* Resets this stream to a clean state. Stateful implementations must implement * Resets this stream to a clean state. Stateful implementations must implement
* this method so that they can be reused, just as if they had been created fresh. * this method so that they can be reused, just as if they had been created fresh.
* <p>
* If you override this method, always call {@code super.reset()}, otherwise
* some internal state will not be correctly reset (e.g., {@link Tokenizer} will
* throw {@link IllegalStateException} on further usage).
*/ */
public void reset() throws IOException {} public void reset() throws IOException {}
/** Releases resources associated with this stream. */ /** Releases resources associated with this stream.
* <p>
* If you override this method, always call {@code super.close()}, otherwise
* some internal state will not be correctly reset (e.g., {@link Tokenizer} will
* throw {@link IllegalStateException} on reuse).
*/
@Override @Override
public void close() throws IOException {} public void close() throws IOException {}