Call for feedback -- enhanced switch
Remi Forax
forax at univ-mlv.fr
Sat Mar 23 17:38:13 UTC 2019
And the expression switch is supported by the latest releases of both IntelliJ IDEA and Eclipse [1]
BTW, it remember me something i have forgotten to ask, for both ecj and javac, when you compile with --enable-preview, all the classes have they minor version changed even the one that doesn't use the switch expression. I've tried to find where this behaviour was documented in the JEP 12 [2] but the "compile-time" section is not clear about that.
Also, the section talk about being able to suppress the preview warning when referencing an entity like a record from another class, but it's not clear if the warning emitted because the switch expression is used in the current class can be suppressed or not, the JEP draws a parallel with @Deprecated so i suppose the answer is yes, in that case javac has to be updated because as far as i know @SuppressWarnings("preview") doesn't work (it works with ecj).
regards,
Rémi
[1] for Eclipse you have to install a patch: https://www.youtube.com/watch?v=TPtXIal9APw
[2] https://openjdk.java.net/jeps/12
----- Mail original -----
> De: "Brian Goetz" <brian.goetz at oracle.com>
> À: "amber-dev" <amber-dev at openjdk.java.net>
> Envoyé: Samedi 23 Mars 2019 17:21:03
> Objet: Re: Call for feedback -- enhanced switch
> Reminder, now that Java 12 is officially out ...
>
> On 3/1/2019 4:55 PM, Brian Goetz wrote:
>> We would like to promote enhanced switch to a permanent feature in Java 13. So
>> far, the only change we are anticipating is:
>>
>> - change “break value” to “break-with value”.
>>
>> This is the time for people to try it out on their codebases (there’s even
>> refactoring support in IDEA!) and provide feedback on what works, what doesn’t,
>> and what was surprising.
>>
More information about the amber-dev
mailing list