This surfaced as an FP of UnusedPrivateMethod. It is caused by the fact that collect is inferred to Map<Object, List<Item>> and not Map<(*unknown*), List<Item>>.
One of the examples where buildItem(a, b) method is considered as unused:
List<SummaryDto.ItemDto> items = new ArrayList<>();
loads.stream()
.collect(Collectors.groupingBy(Item::getValue))
.forEach((a, b) -> items.add(buildItem(a, b)));
private SummaryDto.ItemDto buildItem(BigDecimal a, List<Item> b) {
return SummaryDto.ItemDto.builder()....build();
}
In the case of creating the same method without params - there is no issue
List<SummaryDto.ItemDto> items = new ArrayList<>();
loads.stream()
.collect(Collectors.groupingBy(Item::getValue))
.forEach((a, b) -> items.add(buildItem()));
private SummaryDto.ItemDto buildItem() {
return SummaryDto.ItemDto.builder()....build();
}
Originally posted by @VitaliiIevtushenko in #5184 (comment)
This surfaced as an FP of UnusedPrivateMethod. It is caused by the fact that
collectis inferred toMap<Object, List<Item>>and notMap<(*unknown*), List<Item>>.One of the examples where buildItem(a, b) method is considered as unused:
In the case of creating the same method without params - there is no issue
Originally posted by @VitaliiIevtushenko in #5184 (comment)