PMD is failing with NPE for rule UseIndexOfChar while analyzing Jdk 8 Lambda...
A source code analyzer
Brought to you by:
adangel,
juansotuyo
PMD analysis is failing with NPE for the rule UseIndexOfChar in version 5.1.1. This is happening while analyzing jdk 1.8 code i.e. when the code has lambda expression.
After through analysis I found that the below snippet of code is causing this NPE exception for this rule
code:
Optional<Service> optionalResult = null;
services.stream()
.filter(s -> s.getLastSeen() > 0)
.findFirst();
Please rectify this rule "UseIndexOfChar" to analyse jdk 8 code.
Will be fixed with the next release.