> 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.
Liam Miller-Cushon has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 14 additional commits since the last revision: - Fix more references to newParser - Merge remote-tracking branch 'origin/master' into JDK-8372948 - Remove overload of ParserFactor#newParser - Update newParser call sites - Merge remote-tracking branch 'origin/master' into JDK-8372948 - Rename mapPos to endpos, there is no longer an end position map - Review feedback * Improve valiation in JavacTaskImpl and revert workaround in TestJavacTask_Lock.java * Add an assertion to DiagnosticGetEndPosition.java * Update test/langtools/tools/javac/6304921/TestLog.java for EndPosTable removal - Merge remote-tracking branch 'origin/master' into JDK-8372948 - Merge remote-tracking branch 'origin/master' into JDK-8372948 - Fix DiagnosticGetEndPosition on windows - ... and 4 more: https://git.openjdk.org/jdk/compare/72d5f2a0...f375f9a6 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/28610/files - new: https://git.openjdk.org/jdk/pull/28610/files/31284071..f375f9a6 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=28610&range=11 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28610&range=10-11 Stats: 46344 lines in 610 files changed: 21798 ins; 15694 del; 8852 mod Patch: https://git.openjdk.org/jdk/pull/28610.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/28610/head:pull/28610 PR: https://git.openjdk.org/jdk/pull/28610
