Skip to content

SCANGRADLE-376 Fix gradle9 GH Job on Peachee#445

Open
asya-vorobeva wants to merge 1 commit intomasterfrom
asya/fix-concurrent-modification-exception
Open

SCANGRADLE-376 Fix gradle9 GH Job on Peachee#445
asya-vorobeva wants to merge 1 commit intomasterfrom
asya/fix-concurrent-modification-exception

Conversation

@asya-vorobeva
Copy link
Contributor

Fix ConcurrentModificationException in JavaCompilerUtils.

@hashicorp-vault-sonar-prod
Copy link

hashicorp-vault-sonar-prod bot commented Feb 17, 2026

SONARJAVA-6135

@sonarqube-next
Copy link

@github-actions
Copy link
Contributor

This PR is stale because it has been open 7 days with no activity. If there is no activity in the next 7 days it will be closed automatically

@github-actions github-actions bot added the stale label Feb 25, 2026
@dorian-burihabwa-sonarsource dorian-burihabwa-sonarsource force-pushed the asya/fix-concurrent-modification-exception branch from e03b83a to 5a8595a Compare March 4, 2026 16:57
@github-actions github-actions bot removed the stale label Mar 5, 2026
@dorian-burihabwa-sonarsource dorian-burihabwa-sonarsource force-pushed the asya/fix-concurrent-modification-exception branch from 5a8595a to 6bfe0b8 Compare March 5, 2026 16:24
@sonarqube-next
Copy link

sonarqube-next bot commented Mar 5, 2026

@github-actions
Copy link
Contributor

This PR is stale because it has been open 7 days with no activity. If there is no activity in the next 7 days it will be closed automatically

@github-actions github-actions bot added the stale label Mar 13, 2026
@dorian-burihabwa-sonarsource dorian-burihabwa-sonarsource changed the title SONARJAVA-6135 Fix gradle9 GH Job on Peachee SCANGRADLE-376 Fix gradle9 GH Job on Peachee Mar 19, 2026
Comment on lines +45 to +46
List<JavaCompile> javaCompileTaskList = new ArrayList<>(javaCompileTaskCollection);
if (javaCompileTaskList.isEmpty()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am little skeptical of this solution because of bad past experiences with copying, and underlying iteration, over lazy collection provided by Gradle but let's give it a try. Worst case, it behaves exactly the same as before.

@dorian-burihabwa-sonarsource dorian-burihabwa-sonarsource force-pushed the asya/fix-concurrent-modification-exception branch from 6bfe0b8 to f420099 Compare March 19, 2026 17:33
@sonarqube-next
Copy link

Copy link

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conclusion: Clean, targeted fix. Snapshotting the TaskCollection into an ArrayList before any operations on it is the correct way to avoid ConcurrentModificationException in Gradle 9, and moving the snapshot creation before the isEmpty() check ensures even that first call operates on the stable copy.

🗣️ Give feedback

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants