Python runtime is inconsistent with Java

Hello, I am analyzing c# source code with the grammar files in grammar repository by Python target. I converted the grammar actions to Python source. When I tested the grammar by a simple example, I got ParseCancellationException. After debugging, I find that the method nextTokenOnChannel in class BufferedTokenStream is inconsistent with Java. In Python, the comment says

Return -1 if there are no tokens on channel between i and EOF.

While in Java, it says

Return the index of the EOF token if there are no tokens on channel between {@code i} and EOF.

So, which is correct? Please give a consistent version, thx.