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

Adam Sotona asotona at openjdk.org
Tue Sep 30 15:11:17 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.

Looks good to me.

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

Marked as reviewed by asotona (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/27552#pullrequestreview-3285498523


More information about the compiler-dev mailing list