A RetroSearch Logo

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

Search Query:

Showing content from https://github.com/pmd/pmd/issues/5257 below:

[java] NonCaseLabelInSwitch should consider switch expressions · Issue #5257 · pmd/pmd · GitHub

Affects PMD Version: 7.6.0

Rule: NonCaseLabelInSwitchStatement

Description:

It currently only considers switch statements, but switch expressions could also have non case labels.

Code Sample demonstrating the issue:

public class Foo {
    void bar(int x) {
        x = switch (x) {
            case 2: int y=8;
            somelabel:  // violation expected
                yield y;
            default:
                int j=8;
                yield j;
        };
    }
}

Expected outcome:

PMD should report a violation at line 5, but doesn't. This is a false-negative.


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