diff --git a/Antlr4.Runtime/Atn/ATNConfigSet.cs b/Antlr4.Runtime/Atn/ATNConfigSet.cs index 18e53593e..3339a377e 100644 --- a/Antlr4.Runtime/Atn/ATNConfigSet.cs +++ b/Antlr4.Runtime/Atn/ATNConfigSet.cs @@ -681,7 +681,7 @@ namespace Antlr4.Runtime.Atn { if (!this.HasNext()) { - throw new NoSuchElementException(); + throw new InvalidOperationException(); } this.index++; this.removed = false; diff --git a/Antlr4.Runtime/Dfa/ArrayEdgeMap`1.cs b/Antlr4.Runtime/Dfa/ArrayEdgeMap`1.cs index d58a18a2a..188a550e0 100644 --- a/Antlr4.Runtime/Dfa/ArrayEdgeMap`1.cs +++ b/Antlr4.Runtime/Dfa/ArrayEdgeMap`1.cs @@ -210,7 +210,7 @@ namespace Antlr4.Runtime.Dfa { if (this.current >= this._enclosing.Size()) { - throw new NoSuchElementException(); + throw new InvalidOperationException(); } while (this._enclosing.arrayData[this.currentIndex] == null) { diff --git a/Antlr4.Runtime/Dfa/SingletonEdgeMap`1.cs b/Antlr4.Runtime/Dfa/SingletonEdgeMap`1.cs index b26a18970..56a31638b 100644 --- a/Antlr4.Runtime/Dfa/SingletonEdgeMap`1.cs +++ b/Antlr4.Runtime/Dfa/SingletonEdgeMap`1.cs @@ -182,7 +182,7 @@ namespace Antlr4.Runtime.Dfa { if (this.current >= this._enclosing.Size()) { - throw new NoSuchElementException(); + throw new InvalidOperationException(); } this.current++; return new _KeyValuePair_166(this); diff --git a/Antlr4.Runtime/Dfa/SparseEdgeMap`1.cs b/Antlr4.Runtime/Dfa/SparseEdgeMap`1.cs index d08c70205..2d9578379 100644 --- a/Antlr4.Runtime/Dfa/SparseEdgeMap`1.cs +++ b/Antlr4.Runtime/Dfa/SparseEdgeMap`1.cs @@ -237,7 +237,7 @@ namespace Antlr4.Runtime.Dfa { if (this.current >= this._enclosing.Size()) { - throw new NoSuchElementException(); + throw new InvalidOperationException(); } this.current++; return new _KeyValuePair_226(this); diff --git a/Antlr4.Runtime/Misc/Array2DHashSet`1.cs b/Antlr4.Runtime/Misc/Array2DHashSet`1.cs index 61c20a9e6..f2d9f394b 100644 --- a/Antlr4.Runtime/Misc/Array2DHashSet`1.cs +++ b/Antlr4.Runtime/Misc/Array2DHashSet`1.cs @@ -670,7 +670,7 @@ namespace Antlr4.Runtime.Misc { if (!this.HasNext()) { - throw new NoSuchElementException(); + throw new InvalidOperationException(); } this.removed = false; return this.data[this.nextIndex++]; diff --git a/reference/sharpen-all-options.txt b/reference/sharpen-all-options.txt index 88eb48146..a215ba302 100644 --- a/reference/sharpen-all-options.txt +++ b/reference/sharpen-all-options.txt @@ -188,6 +188,7 @@ -typeMapping java.util.concurrent.CancellationException System.OperationCanceledException -typeMapping java.lang.IndexOutOfBoundsException ArgumentOutOfRangeException -typeMapping java.util.EmptyStackException InvalidOperationException +-typeMapping java.util.NoSuchElementException InvalidOperationException -typeMapping java.io.InputStream System.IO.Stream -typeMapping java.io.InputStreamReader System.IO.StreamReader