yield can not be followed by an underscore ?

Olexandr Rotan rotanolexandr842 at gmail.com
Tue Jun 25 10:52:02 UTC 2024


I`ve filed the issue and opened corresponding pull request with fix:
https://github.com/openjdk/jdk/pull/19878. Hope issue gets published soon

On Tue, Jun 25, 2024 at 1:11 PM Olexandr Rotan <rotanolexandr842 at gmail.com>
wrote:

> Hello Remi. Have you created issue related to this bug? It seems like it
> has been around for quite a while based on what I saw in block parsing code
> of javac
>
> On Tue, Jun 25, 2024, 10:05 Remi Forax <forax at univ-mlv.fr> wrote:
>
>> Hello,
>> javac is not able to parse "yield _ -> ...".
>>
>> Here is a reproducer.
>>
>> public class SwitchYieldAndUnderscore {
>>   public static void main(String[] args) {
>>     Consumer<String> value = switch (args[0]) {
>>       case "foo" -> {
>>         yield _ -> {};
>>       }
>>       default -> throw new AssertionError();
>>     };
>>   }
>> }
>>
>> regards,
>> Rémi
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20240625/eece5fa2/attachment.htm>


More information about the amber-dev mailing list