Inspectopedia
 
2024.3

Labeled switch rule can have code block

Info
New
Last modified: 03 December 2024

Reports rules of switch expressions or enhanced switch statements with an expression body. These can be converted to code blocks.

Example:

After the quick-fix is applied:

This inspection depends on the Java feature 'Enhanced 'switch' blocks', which is available since Java 14.

New in 2019.1