Integrated: 8368848: JShell's code completion not always working for multi-snippet inputs

Jan Lahoda jlahoda at openjdk.org
Thu Oct 2 06:55:57 UTC 2025


On Mon, 29 Sep 2025 16:16:39 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> Having a JShell input like:
> 
> jshell> String s() { return "";} s(). 
> 
> 
> the code completion is not working for it. The reason is that the input is two snippets, but the code completion will interpret it as only one snippet, and a method declaration and method invocation cannot coexist inside one snippet (as one is a declaration that must appear outside of a method, and the invocation must be inside a method body or field initializer).
> 
> The proposal herein is for the JShell's code completion to split the input into snippets, and create a wrapper/compilation unit based on all the snippets.

This pull request has now been integrated.

Changeset: 5251405c
Author:    Jan Lahoda <jlahoda at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/5251405ce9ab1cbd84b798a538cb3865ea4675e9
Stats:     140 lines in 4 files changed: 114 ins; 15 del; 11 mod

8368848: JShell's code completion not always working for multi-snippet inputs

Reviewed-by: asotona

-------------

PR: https://git.openjdk.org/jdk/pull/27552


More information about the compiler-dev mailing list