On Tue, 2 Dec 2025 16:05:27 GMT, Liam Miller-Cushon <[email protected]> wrote:
> This change adds a field to `JCTree` to store end positions, instead of using > a separate `EndPosTable` map. See also [this compiler-dev@ > thread](https://mail.openjdk.org/pipermail/compiler-dev/2025-November/032254.html). > > I performed the refactoring in stages, preserving existing semantics at each > step. > > There are two known places where this changes existing behaviour that are > reflected in changes to tests: > > * `test/langtools/tools/javac/api/TestJavacTask_Lock.java` - this test > asserts that calling `JavacTask#parse` first and then calling `#call` or > `#parse` second will fail. The assertion that the test is currently expecting > is thrown when the `EndPosTable` gets set a second time, and this change > means that no longer results in an exception. If desired `JavacTask#parse` > could be updated to explicitly check if it is called twice and fail, instead > of indirectly relying on the `EndPosTable` for that. > > * `test/langtools/tools/javac/diags/DiagnosticGetEndPosition.java` - there's > a comment that 'ideally would be "0", but the positions are not fully set > yet', and with the new approach the end position is available to the test, so > it resolves the comment. Also the test logic didn't handle platform specific > line ending variations correctly, so I updated it to work on windows now that > end positions are present. This pull request has now been integrated. Changeset: b0829a54 Author: Liam Miller-Cushon <[email protected]> URL: https://git.openjdk.org/jdk/commit/b0829a54cd787d5e378573f69ec0b82b40602454 Stats: 583 lines in 32 files changed: 18 ins; 451 del; 114 mod 8372948: Store end positions directly in JCTree Reviewed-by: jlahoda, mcimadamore ------------- PR: https://git.openjdk.org/jdk/pull/28610
