Use Maven#removeTestCompileSourceRoot instead of Iterator#remove#5258
Conversation
|
This will require Maven 3.9.11, so I'd like to delay it until after the Tycho 5.0.0 release. |
e40734d to
693e44d
Compare
Test Results1 008 files ±0 1 008 suites ±0 4h 54m 18s ⏱️ - 39m 4s For more details on these failures, see this check. Results for commit 2485564. ± Comparison against base commit db7744f. ♻️ This comment has been updated with latest results. |
| for (Iterator<String> iterator = testCompileSourceRoots.iterator(); iterator.hasNext();) { | ||
| String testCompileRoot = iterator.next(); | ||
| private void removeDuplicateTestCompileRoot(File sourceFolder, MavenProject project) { | ||
| for (String testCompileRoot : project.getTestCompileSourceRoots()) { |
There was a problem hiding this comment.
I think we must first copy the list, the implicit iterator of the for-each loop does not play well together with calling remove() on the same list instance.
-for (String testCompileRoot : project.getTestCompileSourceRoots()) {
+for (String testCompileRoot : new ArrayList<>(project.getTestCompileSourceRoots())) {There was a problem hiding this comment.
@sratz while this is true in general and I had the same feeling before when adapting the code, we immediately return when finding a match here so it is okay in this case.
693e44d to
2485564
Compare
FYI @hd42 @akurtakov
Fixes warnings: