PrematureDeclaration lambda false positive
A source code analyzer
Brought to you by:
adangel,
juansotuyo
The rule attempts to detect variables that are allocated but may not be used due to an early return statement. This appears to have not been updated to reflect Java 8 where a lambda may have a return statement, which is not scoped to exit the method. The rule incorreclty flags the method while in actuality the order of statements does not matter.
Thanks! This will be fixed with PMD 5.3.4.
Commit: https://github.com/pmd/pmd/commit/b553c52ef5cec131c042cc2fc74eec6b784e5c3f