Integrated: 8301374: NullPointerException in MemberEnter.checkReceiver

Vicente Romero vromero at openjdk.org
Tue Feb 14 19:02:52 UTC 2023


On Sun, 12 Feb 2023 03:53:02 GMT, Vicente Romero <vromero at openjdk.org> wrote:

> the following incorrect code is crashing javac:
> 
> public class X {
>   interface F {
>     void apply(E e);
>   }
>   enum E {
>     ONE
>   }
> 
>   F f = (E.ONE) -> {};   // E.ONE?
> }
> 
> there are several issues the incorrect argument to this lambda expression. The proposed solution is to issue a syntax error for the missing parameter name. IMO, this error message would be correct here and this way the compiler fails fast instead of having to deal with an erroneous lambda later on to avoid a crash like the one we have now,
> 
> TIA

This pull request has now been integrated.

Changeset: ca73f7e8
Author:    Vicente Romero <vromero at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/ca73f7e80f4a7e3c3c2a68c957412618d042d101
Stats:     16 lines in 3 files changed: 14 ins; 0 del; 2 mod

8301374: NullPointerException in MemberEnter.checkReceiver

Reviewed-by: jlahoda

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

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


More information about the compiler-dev mailing list