Make Kotlin OOCBM updater for modules internal again

Replace direct API access with dedicated service.
This commit is contained in:
Pavel Kirpichenkov
2020-07-29 15:46:47 +03:00
parent 9d6bdc6fc4
commit 1ff064d98d
4 changed files with 29 additions and 10 deletions
@@ -7,14 +7,15 @@ package org.jetbrains.kotlin.idea.caches.project
import com.intellij.openapi.util.ModificationTracker
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionAnchorCacheService
import org.jetbrains.kotlin.idea.caches.trackers.KotlinCodeBlockModificationListener
import org.jetbrains.kotlin.idea.caches.trackers.ResolutionAnchorModificationCountService
class ResolutionAnchorAwareLibraryModificationTracker(
private val libraryInfo: LibraryInfo,
) : ModificationTracker {
override fun getModificationCount(): Long {
val anchorDependencies = ResolutionAnchorCacheService.getInstance(libraryInfo.project).getDependencyResolutionAnchors(libraryInfo)
val updaterForModules = KotlinCodeBlockModificationListener.getInstance(libraryInfo.project).perModuleOutOfCodeBlockTrackerUpdater
return anchorDependencies.maxOfOrNull { updaterForModules.getModificationCount(it.module) } ?: 0
val anchorDependencyModules = ResolutionAnchorCacheService.getInstance(libraryInfo.project)
.getDependencyResolutionAnchors(libraryInfo)
.map { it.module }
return ResolutionAnchorModificationCountService.getLatestModificationCount(anchorDependencyModules)
}
}