Affects PMD Version: 7.1.0
Rule: LambdaCanBeMethodReference
Please provide the rule name and a link to the rule documentation:
https://pmd.github.io/pmd/pmd_rules_java_codestyle.html#lambdacanbemethodreference
Description:
When a method is overloaded like this
public void closeInventory();
public void closeInventory(@NotNull InventoryCloseEvent.Reason reason);
it is not possible to use a method reference, but the rule report it
Code Sample demonstrating the issue:
Bukkit.getScheduler().runTask(BetonQuest.getInstance(), () -> player.closeInventory());
Expected outcome:
no violation
[INFO] PMD Failure: org.betonquest.betonquest.conversation.InventoryConvIO:392 Rule:LambdaCanBeMethodReference Priority:3 Lambda expression could be written as a method reference: player::closeInventory.
Running PMD through: Maven
Affects PMD Version: 7.1.0
Rule: LambdaCanBeMethodReference
Please provide the rule name and a link to the rule documentation:
https://pmd.github.io/pmd/pmd_rules_java_codestyle.html#lambdacanbemethodreference
Description:
When a method is overloaded like this
it is not possible to use a method reference, but the rule report it
Code Sample demonstrating the issue:
Expected outcome:
no violation
[INFO] PMD Failure: org.betonquest.betonquest.conversation.InventoryConvIO:392 Rule:LambdaCanBeMethodReference Priority:3 Lambda expression could be written as a method reference:
player::closeInventory.Running PMD through: Maven