8230342: LineNumberReader.getLineNumber() returns inconsistent results after EOF

Daniel Fuchs daniel.fuchs at oracle.com
Tue Sep 10 14:57:44 UTC 2019


Hi,

On 09/09/2019 15:35, Roger Riggs wrote:
> - Is the use of AtomicBoolean due to concurrency concerns?
>    If not, a new boolean[1] would be less overhead

Alternatively, BufferedReader could define an empty package
method called e.g.

    void endOfLine() { };

that LineNumberReader could override to increment lineNumber.

So:

  351                         if (term != null) term.set(true);

would simply become

  351                         endOfLine();

which would be a no-op for BufferedReader but would increment
lineNumber for LineNumberReader.

Wouldn't that work too?

best regards

-- daniel


More information about the core-libs-dev mailing list