Menu

#1397 StringToString should ignore method references

PMD-5.3.4
closed
None
PMD
3-Major
Bug
5.3.3
strings / StringToString
2015-09-07
2015-08-29
Ben Manes
No

The rule should not be triggered when a toString() is passed as a method reference. In general a method reference is preferred to an ad hoc lambda by having shorter byte code and potential for future JVM optimizations.

void log(Supplier<string> msg) { ... }
log("abc"::toString); // fails rule
log(() -> "abc"); // passes rule</string>

Discussion

  • Andreas Dangel

    Andreas Dangel - 2015-09-07
    • status: open --> closed
    • assigned_to: Andreas Dangel
    • Milestone: New Tickets --> PMD-5.3.4
     

Log in to post a comment.