RFR: 8374293: Jshell throws an error and crashes when using keyword Public
Jan Lahoda
jlahoda at openjdk.org
Thu Jan 8 14:18:19 UTC 2026
On Fri, 2 Jan 2026 13:03:28 GMT, Lei Zhu <duke at openjdk.org> wrote:
> `jdk.jshell.SourceCodeAnalysis#highlights` should not return overlapping highlights, so use `TreeSet` for deduplication and sorting.
I think I am OK with the change as such, but the test needs a little tweak, I think. Thanks!
test/langtools/jdk/jshell/SnippetHighlightTest.java line 125:
> 123: }
> 124:
> 125: /**
Nit: using 3 lines just to add a simple reference to the bug seems a bit too much. Could it be changed to something like:
@Test //8374293: The returned Highlights should not overlap
?
test/langtools/jdk/jshell/SnippetHighlightTest.java line 129:
> 127: */
> 128: @Test
> 129: public void testHighlightsOverlap() {
Note the test passes even without the patch, because `computeHighlights` below does `distinct()`. I'd suggest to delete the `distinct()`, that should (I think) make the test fail without the patch and pass with the patch (?).
-------------
Marked as reviewed by jlahoda (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/29018#pullrequestreview-3639614833
PR Review Comment: https://git.openjdk.org/jdk/pull/29018#discussion_r2672526924
PR Review Comment: https://git.openjdk.org/jdk/pull/29018#discussion_r2672521784
More information about the compiler-dev
mailing list