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] MissingStaticMethodInNonInstantiatableClass false positive with method inner classes · Issue #3701 · pmd/pmd Closed Labels a:false-positivePMD flags a piece of code that is not problematic Milestone DescriptionAffects PMD Version: 6.41.0 Rule: MissingStaticMethodInNonInstantiatableClass Please provide the rule name and a link to the rule documentation: Description: Using a method nested class causes a false positive: PMD Failure: Scratch$InnerClass:11 Rule:MissingStaticMethodInNonInstantiatableClass Priority:3 Class cannot be instantiated and does not provide any static methods or fields. Code Sample demonstrating the issue: public class Scratch { public static void main(String[] args) { Scratch scratch = new Scratch(); scratch.callMethod(); } void callMethod() { class InnerClass { private InnerClass() { } void display() { System.out.println("Works OK!"); } } InnerClass innerClass = new InnerClass(); innerClass.display(); } } This code compiles just fine and running it prints Expected outcome: PMD understands this code just fine PMD reports a violation at line 11, but that's wrong. That's a false positive. Running PMD through: [Maven] 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. |