False positive: UnnecessaryLocalBeforeReturn
A source code analyzer
Brought to you by:
adangel,
juansotuyo
Hello,
A local assignment before return should not be an error if that assignment is annotated.
Example:
public int getVisibleIndex(){
....@SuppressWarnings("unchecked")
....int index = ((Container<component>)this.getContainer()).indexOf(this.getVisibleComponent());
....return index;
}</component>
In this case the annotation on the assignment is required to avoid annotating the whole method for this particular statement. The local assignment before return is therefore required, and should not cause PMD to report an error.
Duplicate of https://sourceforge.net/p/pmd/bugs/933/
[#933]
Related
Issues:
#933