Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] ConstructorCallsOverridableMethod false positive when calling super method #1718

Closed
Andy-2639 opened this issue Mar 13, 2019 · 0 comments · Fixed by #4101
Closed

[java] ConstructorCallsOverridableMethod false positive when calling super method #1718

Andy-2639 opened this issue Mar 13, 2019 · 0 comments · Fixed by #4101
Labels
a:false-positive PMD flags a piece of code that is not problematic
Milestone

Comments

@Andy-2639
Copy link

Andy-2639 commented Mar 13, 2019

Affects PMD Version: 6.12.0
Rule: ConstructorCallsOverridableMethod
Running PMD through: PMD Eclipse Plugin version 4.1.0

Code Sample demonstrating the issue:

public class A {
    public void doA() {}
}

public class B extends A {
    public B() {
        super.doA();  // <-- PMD: Overridable method 'doA' called during object construction
    }

    @Override
    public void doA() {
        throw new UnsupportedOperationException();
    }
}

Description:

In B's constructor, PMD reports that an overridable method is called. However, it is a super method call. So I think it is a false positive.

@jsotuyod jsotuyod added the a:false-positive PMD flags a piece of code that is not problematic label Apr 1, 2019
@adangel adangel added this to the 6.50.0 milestone Sep 29, 2022
adangel added a commit to adangel/pmd that referenced this issue Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:false-positive PMD flags a piece of code that is not problematic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants