A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/4924 below:

[java] UnnecessaryBoxing false positive in PMD 7.0.0 in lambda · Issue #4924 · pmd/pmd · GitHub

Hi!
I am currently trying to update from 6.55.0 to PMD 7.0.0.

Affects PMD Version: 7.0.0

Rule: UnnecessaryBoxing

Code Sample demonstrating the issue:

import java.util.Optional;

public class Example {

  record Item(int cents) {}

  Long map(Item item) {
    return Optional.ofNullable(item).map(it -> Long.valueOf(it.cents())).orElse(null);
  }
}

Outcome:

PMD Failure: Example:10 Rule:UnnecessaryBoxing Priority:3 
Unnecessary explicit conversion from int to Function<? super Item, ? extends Long>

Running PMD through: maven-pmd-plugin 3.21.2


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4