A RetroSearch Logo

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

Search Query:

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

[apex] Unused Local Variable fails on blocks · Issue #2468 · pmd/pmd · GitHub

Affects PMD Version:
6.23

Rule: UnusedLocalVariable

Description:

The rule added in PR #2395 by @gwilymatgearset is way too simplistic and only checks the code in the current block for used or unused. As soon as the variable is used in a nested block (if/for) it's detected as unused.

public void foo() {
    Integer used;

    if(true) {
        for(Integer i=0; i<10; i++) {
            used++;
        }
    }
}

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