diff --git a/docs/changelog.md b/docs/changelog.md index 31630142..02de31cb 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,9 @@ ## Unreleased +## 0.6.3 +* Fix ClassCastException caused by race condition. [PR](https://github.com/runningcode/gradle-doctor/pull/129) + ## 0.6.2 * [Add threshold for negative avoidance savings.](https://github.com/runningcode/gradle-doctor/pull/126) diff --git a/doctor-plugin/src/main/java/com/osacky/doctor/BuildOperations.kt b/doctor-plugin/src/main/java/com/osacky/doctor/BuildOperations.kt index cba9a8b4..2a80a1fc 100644 --- a/doctor-plugin/src/main/java/com/osacky/doctor/BuildOperations.kt +++ b/doctor-plugin/src/main/java/com/osacky/doctor/BuildOperations.kt @@ -13,11 +13,13 @@ import org.gradle.internal.operations.OperationFinishEvent import org.gradle.internal.operations.OperationIdentifier import org.gradle.internal.operations.OperationProgressEvent import org.gradle.internal.operations.OperationStartEvent +import java.util.concurrent.ConcurrentHashMap class BuildOperations(negativeAvoidanceThreshold: Property) : OperationEvents, BuildOperationListener { // TODO move this out of this class - private val snapshotIdsMap = HashMap() + // When multiple threads are accessing this HashMap, a ClassCastException may be thrown. + private val snapshotIdsMap = ConcurrentHashMap() private val executeTaskIdsMap = HashMap() private val starts: PublishSubject = PublishSubject.create()