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] DoNotUseThreads report duplicate warnings #4210

Closed
ghost opened this issue Nov 12, 2022 · 1 comment · Fixed by #4247
Closed

[java] DoNotUseThreads report duplicate warnings #4210

ghost opened this issue Nov 12, 2022 · 1 comment · Fixed by #4247
Labels
a:false-positive PMD flags a piece of code that is not problematic
Milestone

Comments

@ghost
Copy link

ghost commented Nov 12, 2022

Affects PMD Version:6.51.0

Rule: DoNotUseThreads

Please provide the rule name and a link to the rule documentation:
https://pmd.github.io/latest/pmd_rules_java_multithreading.html#donotusethreads

Description:
In the following code example, line 2 uses the class Thread which should be forbiden and it reports two duplicate warnings.

Code Sample demonstrating the issue:

public final class Test {  
    public final Thread BAR = new Thread();  // report two duplicate warnings in this line
   
    public Thread getBAR() {  // report one warning in this line
        return this.BAR;
    }
}

Expected outcome:

PMD reports two duplicate warnings at line 2, but one warning is appropriate.

Running PMD through: CLI

@ghost ghost added the a:false-negative PMD doesn't flag a problematic piece of code label Nov 12, 2022
@ghost

This comment was marked as resolved.

@oowekyala oowekyala added a:false-positive PMD flags a piece of code that is not problematic and removed a:false-negative PMD doesn't flag a problematic piece of code labels Nov 12, 2022
@adangel adangel added this to the 6.53.0 milestone Nov 17, 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.

2 participants