Details
Description
With new switch expression (Java 12), return values from functions without side effects are not ignored.
String s = ""; String v = switch (cond) { case "1" -> "aValue"; case "2" -> s.toString(); // FP case "3" -> s.substring(1); // FP default -> s.replace('a', 'b'); // FP };
Attachments
Issue Links
- relates to
-
SONARJAVA-3286 Support Java 14
-
- Closed
-
-
SONARJAVA-3047 Handle Java 12 new switch expression
-
- Closed
-
-
RSPEC-2201 Return values from functions without side effects should not be ignored
- Active
- links to