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

Jan Lahoda jlahoda at openjdk.java.net
Thu Sep 10 13:56:46 UTC 2020


> 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.

Jan Lahoda 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 three additional commits since
the last revision:

 - Improving behavior for vararg method invocations.
 - Merge branch 'master' into JDK-8240658
 - 8240658: Code completion not working for lambdas in method invocations that require type inference

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/50/files
  - new: https://git.openjdk.java.net/jdk/pull/50/files/7f4e903e..32845ddb

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=50&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=50&range=00-01

  Stats: 15586 lines in 549 files changed: 10380 ins; 2664 del; 2542 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 compiler-dev mailing list