RFR: 8301374: NullPointerException in MemberEnter.checkReceiver [v2]

Vicente Romero vromero at openjdk.org
Tue Feb 14 17:58:19 UTC 2023


> 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

Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:

  addressing review comments

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/12523/files
  - new: https://git.openjdk.org/jdk/pull/12523/files/62284265..04020e46

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=12523&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=12523&range=00-01

  Stats: 4 lines in 2 files changed: 1 ins; 1 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/12523.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12523/head:pull/12523

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


More information about the compiler-dev mailing list