From 633a2df710d733e5721fbf3e4a743047e4920700 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Sat, 7 Jan 2017 10:40:25 -0600 Subject: [PATCH] Mark BufferedTokenStream.reset as deprecated to avoid confusion See #895 --- .../src/org/antlr/v4/runtime/BufferedTokenStream.java | 8 ++++++++ .../test/org/antlr/v4/test/tool/TestPerformance.java | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/runtime/Java/src/org/antlr/v4/runtime/BufferedTokenStream.java b/runtime/Java/src/org/antlr/v4/runtime/BufferedTokenStream.java index c0e5e89d4..f765a85b4 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/BufferedTokenStream.java +++ b/runtime/Java/src/org/antlr/v4/runtime/BufferedTokenStream.java @@ -89,6 +89,14 @@ public class BufferedTokenStream implements TokenStream { // no resources to release } + /** + * This method resets the token stream back to the first token in the + * buffer. It is equivalent to calling {@link #seek}{@code (0)}. + * + * @see #setTokenSource(TokenSource) + * @deprecated Use {@code seek(0)} instead. + */ + @Deprecated public void reset() { seek(0); } diff --git a/tool-testsuite/test/org/antlr/v4/test/tool/TestPerformance.java b/tool-testsuite/test/org/antlr/v4/test/tool/TestPerformance.java index e10bd42f0..1cf309b86 100644 --- a/tool-testsuite/test/org/antlr/v4/test/tool/TestPerformance.java +++ b/tool-testsuite/test/org/antlr/v4/test/tool/TestPerformance.java @@ -1288,7 +1288,7 @@ public class TestPerformance extends BaseJavaToolTest { throw ex; } - tokens.reset(); + tokens.seek(0); if (REUSE_PARSER && parser != null) { parser.setInputStream(tokens); } else {