RFR: 8240658: Code completion not working for lambdas in method invocations that require type inference

Robert Field robert.field at oracle.com
Thu Sep 10 23:24:39 UTC 2020


The code changes are in the javac code, so an active compiler team 
member would be the appropriate review.

The jshell test looks good.

Thanks for addressing this,
Robert


On 2020-09-07 04:35, Jan Lahoda wrote:
> When a method invocation requires type inference, and the user is in the process of typing of a (block) lambda that is
> a parameter to the method invocation, javac may not, in some cases, perform the type inference, which then may lead to
> non working code completion in JShell (and possibly other tools).
>
> For example (in JShell):
> Arrays.stream(new Integer[]{1}).forEach(v -> { System.err.println(v.
>
> and press <tab> - this leads to no proposals currently, as the type of "v" is not inferred.
>
> The idea of the proposed patch is to improve the recovery in cases significant for cases where the text is being typed,
> and allow type inference in these cases. The type of "v" is then inferred, and the code completion works.
>
> -------------
>
> Commit messages:
>   - 8240658: Code completion not working for lambdas in method invocations that require type inference
>
> Changes: https://git.openjdk.java.net/jdk/pull/50/files
>   Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=50&range=00
>    Issue: https://bugs.openjdk.java.net/browse/JDK-8240658
>    Stats: 661 lines in 9 files changed: 625 ins; 6 del; 30 mod
>    Patch: https://git.openjdk.java.net/jdk/pull/50.diff
>    Fetch: git fetch https://git.openjdk.java.net/jdk pull/50/head:pull/50
>
> PR: https://git.openjdk.java.net/jdk/pull/50


More information about the kulla-dev mailing list