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 14:00:32 UTC 2020


On Tue, 8 Sep 2020 22:54:24 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> 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
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrRecover.java line 151:
> 
>> 149:                                 }
>> 150:                                 @Override
>> 151:                                 public void visitClassDef(JCClassDecl tree) {
> 
> just wondering, shouldn't anonymous classes be avoided too?

Anonymous classes (JCNewClass) contain JCClassDecl representing the actual anonymous class, so this should avoid
anonymous classes as well.

> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrRecover.java line 103:
> 
>> 101:                 if ((todo.candSym.flags() & Flags.VARARGS) == 0 &&
>> 102:                     mit.args.length() > todo.candSym.type.getParameterTypes().length()) {
>> 103:                     break RECOVER; //too many actual parameters, skip
> 
> question: why not covering varargs too?

Note this is a case where the invoked method is not a varargs method, and there are too many actual parameters. But it
is true the varags handling could be improved, which I tried to do in a recent patch (32845dd).

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

PR: https://git.openjdk.java.net/jdk/pull/50


More information about the compiler-dev mailing list