RFR: 8371309: Diagnostic.getEndPosition can throw an NPE with typical broken code
Liam Miller-Cushon
cushon at openjdk.org
Wed Nov 26 08:37:12 UTC 2025
On Wed, 19 Nov 2025 08:58:32 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
> It seems like more realistic (and accurate) specification would be:
>
> > offset from beginning of file; `NOPOS` if the ending position is not available
It does seem like this changed the historic behaviour--in the past synthetic AST nodes with end position information had an end position of `NOPOS`, after this change they have an end position that is the same as their start position.
I have seen some clients of this API that were checking for `endpos == NOPOS` that need to be updated to also check `endpos == pos`. (I understand this is not part of any supported API, I am not asking for a change here.)
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28316#issuecomment-3580117602
More information about the compiler-dev
mailing list