Files
openide/java/java-impl/resources/inspectionDescriptions/EnhancedSwitchBackwardMigration.html
2025-02-05 04:43:28 +00:00

35 lines
773 B
HTML

<html>
<body>
Reports enhanced <code>switch</code> statements and expressions. Suggests replacing them with regular <code>switch</code>
statements.
<p><b>Example:</b></p>
<pre><code>
boolean even = switch (condition) {
case 1, 3, 5, 7, 9 -> false;
default -> true;
};
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
boolean even;
switch (condition) {
case 1:
case 3:
case 5:
case 7:
case 9:
even = false;
break;
default:
even = true;
break;
}
</code></pre>
<!-- tooltip end -->
<p>
<i>Enhanced</i> <code>switch</code> appeared in Java 14.
This inspection can help to downgrade for backward compatibility with earlier Java versions.
</p>
<p><small>New in 2019.1</small></p>
</body>
</html>