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] False positive for `DoNotExtendJavaLangError` #1021

Closed
mnlipp opened this Issue Apr 4, 2018 · 2 comments

Comments

Projects
None yet
4 participants
@mnlipp

mnlipp commented Apr 4, 2018

Affects PMD Version: 6.2.0

Rule: DoNotExtendJavaLangError

Description: If I extend a class Error (a class of my own, not java.lang.Error) PMD finds a false positive.

Code Sample demonstrating the issue: Too difficult to cut and paste here. Just declare a class Error and another one that extends it.

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other] pmd-eclipse 1.11.0

@adangel

This comment has been minimized.

Show comment
Hide comment
@adangel

adangel Apr 4, 2018

Member

Thanks for reporting.
Yes, this rule does a simple String match to determine, whether it is java.lang.Error or not.
The rule should be updated to use type resolution, which is also available for XPath rules.

Member

adangel commented Apr 4, 2018

Thanks for reporting.
Yes, this rule does a simple String match to determine, whether it is java.lang.Error or not.
The rule should be updated to use type resolution, which is also available for XPath rules.

@jsotuyod jsotuyod changed the title from [Java] False positive for `DoNotExtendJavaLangError` to [java] False positive for `DoNotExtendJavaLangError` Apr 4, 2018

@akshatbahety

This comment has been minimized.

Show comment
Hide comment
@akshatbahety

akshatbahety May 1, 2018

Contributor

@oowekyala @adangel I will try to solve this.

Contributor

akshatbahety commented May 1, 2018

@oowekyala @adangel I will try to solve this.

akshatbahety added a commit to akshatbahety/pmd that referenced this issue May 14, 2018

akshatbahety added a commit to akshatbahety/pmd that referenced this issue May 14, 2018

Fixes #1021
adding the error file for typeres

@oowekyala oowekyala added this to the 6.4.0 milestone May 15, 2018

@oowekyala oowekyala added the has:pr label May 15, 2018

@oowekyala oowekyala closed this in #1101 May 17, 2018

oowekyala added a commit that referenced this issue May 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment