Ensure #1563 is fixed

Fix #1563
This commit is contained in:
Clément Fournier
2023-04-25 21:47:04 +02:00
parent d04a1af8d3
commit c4e0586dd4
2 changed files with 18 additions and 0 deletions

View File

@ -344,6 +344,7 @@ Language specific fixes:
* [#1205](https://github.com/pmd/pmd/issues/1205): \[java] Improve ConstantsInInterface message to mention alternatives
* [#1212](https://github.com/pmd/pmd/issues/1212): \[java] Don't raise JUnitTestContainsTooManyAsserts on JUnit 5's assertAll
* [#1422](https://github.com/pmd/pmd/issues/1422): \[java] JUnitTestsShouldIncludeAssert false positive with inherited @<!-- -->Rule field
* [#1563](https://github.com/pmd/pmd/issues/1563): \[java] False positive ForLoopCanBeForeach
* [#1565](https://github.com/pmd/pmd/issues/1565): \[java] JUnitAssertionsShouldIncludeMessage false positive with AssertJ
* [#1747](https://github.com/pmd/pmd/issues/1747): \[java] PreserveStackTrace false-positive
* [#1969](https://github.com/pmd/pmd/issues/1969): \[java] MissingOverride false-positive triggered by package-private method overwritten in another package by extending class

View File

@ -409,4 +409,21 @@ public class Test {
}
]]></code>
</test-code>
<test-code>
<description>#1563 FP with ForLoopCanBeForeach</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import java.util.List;
class X {
private void fofo(List<Foo> mList) {
for (int i = 0; i < mList.size(); i++) {
mList.get(i).setIndex(i);
}
}
interface Foo {
void setIndex(int i);
}
}
]]></code>
</test-code>
</test-data>