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] ForLoopCanBeForeach false positive with method call using index variable #1563

Closed
scottkennedy opened this issue Jan 8, 2019 · 0 comments
Labels
a:false-positive PMD flags a piece of code that is not problematic
Milestone

Comments

@scottkennedy
Copy link

Affects PMD Version:
6.10.0

Rule:
ForLoopCanBeForeach

Description:
I have code very similar to the following that's producing a ForLoopCanBeForeach issue, even though I definitely need the index variable.

Code Sample demonstrating the issue:

for (int i = 0; i < mList.size(); i++) {
    mList.get(i).setIndex(i);
}

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
Gradle

@jsotuyod jsotuyod added the a:false-positive PMD flags a piece of code that is not problematic label Jan 8, 2019
@oowekyala oowekyala added this to the 7.0.0 milestone Apr 25, 2023
@adangel adangel changed the title [java] False positive ForLoopCanBeForeach [java] ForLoopCanBeForeach false positive with method call using index variable Apr 27, 2023
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

No branches or pull requests

3 participants