False positive UnusedPrivateMethod with JAVA8
A source code analyzer
Brought to you by:
adangel,
juansotuyo
There is a false positive UnusedPrivateMethod with this kind of code :
public class Something { @Test public void mapMergeShouldReturnTheUnionWhenGivenDifferentSetsWithSomeCommonValues() { final Map<String, Purse> actual = Combiners.mapMerge(mapOf(annPurse5, bobPurse7), mapOf(bobPurse9, calPurse10), ADDITION); assertEquals(mapOf(annPurse5, bobPurse16, calPurse10), actual); } private static Map<String, Purse> mapOf(final Purse... values) { return mapOf(Purse::getOwner, values); } private static <K, V> Map<K, V> mapOf(final Function<V, K> keyMapper, final V... values) { return Stream.of(values).collect(Collectors.toMap(keyMapper, Function.identity())); } }
Maybe because of Java 8 "mapOf(Purse::getOwner, values)" or private called by private ?
Thanks,
Diff:
This will be fixed with PMD 5.3.4.
Commit: https://github.com/pmd/pmd/commit/2500412b147a31cef5940aba9ca0b504dd39003f