Jump statements should not be redundant (squid:S3626) FP in try block

SonarQube version: 6.7.6 LTS (build 38781)
Java Plugin version: 5.11 (build 17289)

    void foo(boolean b) {
        try {
            if (b) {
                System.out.println("work block A");
            } else {
                return;
            }
        } finally {
            System.out.println("work block B");
        }
        System.out.println("work block C");
    }

squid:S3626 triggers on the line with the return statement.
If the return statement is removed then work block C will be executed.

Hi,

If I understand correctly you are hitting a variation of : https://jira.sonarsource.com/browse/SONARJAVA-3058

Thanks for the reproducer, i’ll add it to the ticket !

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.