Skip to content

Commit

Permalink
fix: concurrent modification exception
Browse files Browse the repository at this point in the history
  • Loading branch information
BFergerson committed Aug 22, 2022
1 parent 394aa4d commit a6d4443
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package spp.jetbrains.marker.source

import com.google.common.collect.ImmutableList
import com.google.common.collect.MapMaker
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.diagnostic.logger
Expand Down Expand Up @@ -63,10 +64,8 @@ open class SourceFileMarker(val psiFile: PsiFile) : SourceMarkProvider {
}
}

private val sourceMarks: MutableSet<SourceMark> = Collections.synchronizedSet(
Collections.newSetFromMap(IdentityHashMap())
)
val project: Project = psiFile.project
private val sourceMarks: MutableSet<SourceMark> = Collections.newSetFromMap(MapMaker().weakKeys().makeMap())

/**
* Gets the [SourceMark]s recognized in the current source code file.
Expand Down Expand Up @@ -108,7 +107,7 @@ open class SourceFileMarker(val psiFile: PsiFile) : SourceMarkProvider {

open fun removeInvalidSourceMarks(): Boolean {
var removedMark = false
sourceMarks.toList().forEach {
sourceMarks.forEach {
if (!it.valid) {
check(removeSourceMark(it))
removedMark = true
Expand Down

0 comments on commit a6d4443

Please sign in to comment.