A RetroSearch Logo

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

Search Query:

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

False negative for enum method · Issue #3542 · pmd/pmd · GitHub

Affects PMD Version:6.39.0

Rule:MissingOverride

Please provide the rule name and a link to the rule documentation:
https://pmd.github.io/pmd-6.39.0/pmd_rules_java_bestpractices.html#missingoverride

Description:
PMD should have reported two warnings at line 3 and line 10. These two methods are inherited from superclass and they are belong to corresponding enum classes.

Code Sample demonstrating the issue:

public enum enumClazz {
    sub_EnumClazz {
        // missing @Override --> this is already reported
        public String toString() {
            return "test";
        }
        // missing @Override --> this violation is missing
        public void notOverride() {
            System.out.println("test");
        }
    };

    // missing @Override --> this is already reported
    public String toString() {
        return "test";
    }
    public void notOverride() {
        System.out.println("test");
    }
}

Expected outcome: Two warnings

PMD should report three violations at line 4, 8, and 14, but doesn't. Only 4 and 14 are reported. Line 8 is missing. This is a false-negative.

Running PMD through: [Maven]


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