GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — [java] UnusedPrivateMethod: False positive with overloaded private methods called with values returned from methods defined in other classes · Issue #6393 · pmd/pmd Closed DescriptionAffects PMD Version: Rule: Please provide the rule name and a link to the rule documentation: Description: Also, if the class with the Code Sample demonstrating the issue: public interface UnusedPrivateMethodFalsePositivePrivateMethod { default String publicMethod(final Thing l) { return transform(l.getLong()); } default String publicMethod2(final Thing l) { return transform(l.getString()); } private String transform(final String l) { return switch (l) { case "1" -> "one"; case "2" -> "two"; default -> l; }; } private String transform(final Long l) { // Violation here return switch (l.intValue()) { case 1 -> "one"; case 2 -> "two"; default -> l.toString(); }; } } public class Thing { public String getString() { return "thing"; } public Long getLong() { return 1L; } } Expected outcome: PMD reports a violation for Running PMD through: Maven Maven Log[INFO] >>> pmd:3.28.0:check (pmd) > :pmd @ uk-auto-confused-quoting >>> [INFO] [INFO] --- pmd:3.28.0:pmd (pmd) @ uk-auto-confused-quoting --- [INFO] PMD version: 7.20.0 [WARNING] Unable to find a URL to the parent project. The parent menu will NOT be added. [INFO] Rendering content with org.apache.maven.skins:maven-fluido-skin:jar:2.0.0-M9 skin [INFO] [INFO] <<< pmd:3.28.0:check (pmd) < :pmd @ uk-auto-confused-quoting <<< [INFO] [INFO] [INFO] --- pmd:3.28.0:check (pmd) @ uk-auto-confused-quoting --- [WARNING] PMD Failure: com.marshmallow.uk_auto_confused_quoting.service.common.UnusedPrivateMethodFalsePositivePrivateMethod:21 Rule:UnusedPrivateMethod Priority:3 Avoid unused private methods such as 'transform(Long)'.. Activity
MetadataMetadataAssigneesLabelsa:false-positivePMD flags a piece of code that is not problematic TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |