A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://bugs.openjdk.java.net/browse/JDK-8207241 below:

Loading...

Summary

Extend the switch statement so that it can be used as either a statement or an expression, and so that both forms can use either a traditional case : label (with fall through) or a simplified case -> label (no fall through).

Problem

Several irregularities of the switch statement have long been an irritation to users, and impediments to support for features like pattern matching. These irregularities include (i) the default control flow behavior (fall through) of switch blocks, (ii) the default scoping of switch blocks (the block is treated as one single scope), and (iii) the fact that switch works only as a statement, even though it is commonly more natural to express multi-way conditionals as expressions.

Solution

The JLS will be enhanced with support for:

These features, as a group, will constitute a preview feature (JEP 12) in Java SE 12.

Specification

Proposed changes to the JLS are attached to this CSR. The changes are also available at http://cr.openjdk.java.net/~gbierman/switch-expressions-2019-01.html. There are no changes to the JVMS.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4