Yield _ is not recognized as a valid code by javac

Remi Forax forax at univ-mlv.fr
Thu Oct 10 08:38:09 UTC 2024


Ok,
i'm at Devoxx BE seated near Stuart Marks and he explained to me that it was integrated in Java 24,
it's me not being able to decipher the bug report correctly,
so sorry for the noise.

Rémi


----- Original Message -----
> From: "Remi Forax" <forax at univ-mlv.fr>
> To: "amber-dev" <amber-dev at openjdk.org>
> Sent: Thursday, October 10, 2024 10:06:33 AM
> Subject: Re: Yield _ is not recognized as a valid code by javac

> Opps, i click submit too fast, an issue was open
> (https://bugs.openjdk.org/browse/JDK-8335136)
> but it has been closed without me understanding why.
> 
> Rémi
> 
> ----- Original Message -----
>> From: "Remi Forax" <forax at univ-mlv.fr>
>> To: "amber-dev" <amber-dev at openjdk.org>
>> Sent: Thursday, October 10, 2024 9:58:22 AM
>> Subject: Yield _ is not recognized as a valid code by javac
> 
>> Hello,
>> It seems javac grammar does not allow yield to be follow by an '_'.
>> 
>> void main(String[] args) {
>>  Consumer<String> value = switch (args[0]) {
>>    case "foo" -> {
>>      yield _ -> {};
>>    }
>>    default -> throw new AssertionError();
>>  };
>> }
>> 
>> Both ecj and the front compiler of IntelliJ as no trouble with this code,
>> it seems to be just a javac bug.
>> 
>> regards,
> > Rémi


More information about the amber-dev mailing list