Fix IndexOutOfBoundsException when using ANTLR with Java 8 (fixes #337)