RFR: 8322810: Lambda expressions can implement classes [v2]

Vicente Romero vromero at openjdk.org
Thu Apr 10 01:28:18 UTC 2025


> Currently javac is accepting code like:
> 
> 
> class Test {
>     void m() {
>         var r = (Test & Runnable) () -> System.out.println("Hello, World!");
>     }
> }
> 
> 
> according to: `4.9 Intersection Types` a notional interface can't be induced here as one of the components is a class different from `j.l.Object`
> 
> With this fix this code pattern will be rejected with a compiler error
> 
> TIA

Vicente Romero 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:

 - Merge branch 'master' into JDK-8322810
 - modifying comment
 - 8322810: Lambda expressions can implement classes

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/24548/files
  - new: https://git.openjdk.org/jdk/pull/24548/files/3e8bdc16..16a0ad4d

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

  Stats: 3639 lines in 120 files changed: 1307 ins; 1473 del; 859 mod
  Patch: https://git.openjdk.org/jdk/pull/24548.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24548/head:pull/24548

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


More information about the compiler-dev mailing list