RFR: 8322810: Lambda expression types can't be classes [v7]
Vicente Romero
vromero at openjdk.org
Fri Apr 11 15:55:37 UTC 2025
On Fri, 11 Apr 2025 00:43:02 GMT, Vicente Romero <vromero at openjdk.org> wrote:
>> 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 incrementally with one additional commit since the last revision:
>
> additional tests
I had a minor bug in the test, duplicated variable names, so I will need another approval plus a review of the CSR to fast-track it. Thanks for all the comments!
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24548#issuecomment-2797318079
More information about the compiler-dev
mailing list