From 54811613f46bcd12070d52566d048fd98857b869 Mon Sep 17 00:00:00 2001 From: Pavel Kirpichenkov Date: Sat, 1 Aug 2020 12:29:44 +0300 Subject: [PATCH] Minor: drop unnecessary wrapper for utility function ^KT-39734 --- ...onAnchorAwareLibraryModificationTracker.kt | 4 ++-- ...esolutionAnchorModificationCountService.kt | 21 ------------------- .../trackers/modificationTrackerUtil.kt | 19 +++++++++++++++++ 3 files changed, 21 insertions(+), 23 deletions(-) delete mode 100644 idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/caches/trackers/ResolutionAnchorModificationCountService.kt create mode 100644 idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/caches/trackers/modificationTrackerUtil.kt diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/ResolutionAnchorAwareLibraryModificationTracker.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/ResolutionAnchorAwareLibraryModificationTracker.kt index 0eb150e3af4..8f65844cf47 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/ResolutionAnchorAwareLibraryModificationTracker.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/ResolutionAnchorAwareLibraryModificationTracker.kt @@ -7,7 +7,7 @@ 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.ResolutionAnchorModificationCountService +import org.jetbrains.kotlin.idea.caches.trackers.getLatestModificationCount class ResolutionAnchorAwareLibraryModificationTracker( private val libraryInfo: LibraryInfo, @@ -16,6 +16,6 @@ class ResolutionAnchorAwareLibraryModificationTracker( val anchorDependencyModules = ResolutionAnchorCacheService.getInstance(libraryInfo.project) .getDependencyResolutionAnchors(libraryInfo) .map { it.module } - return ResolutionAnchorModificationCountService.getLatestModificationCount(anchorDependencyModules) + return getLatestModificationCount(anchorDependencyModules) } } diff --git a/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/caches/trackers/ResolutionAnchorModificationCountService.kt b/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/caches/trackers/ResolutionAnchorModificationCountService.kt deleted file mode 100644 index bd7288d3a7e..00000000000 --- a/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/caches/trackers/ResolutionAnchorModificationCountService.kt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.caches.trackers - -import com.intellij.openapi.module.Module -import com.intellij.openapi.util.ModificationTracker - -object ResolutionAnchorModificationCountService { - fun getLatestModificationCount(anchorModules: Collection): Long { - if (anchorModules.isEmpty()) - return ModificationTracker.NEVER_CHANGED.modificationCount - - val modificationCountUpdater = - KotlinCodeBlockModificationListener.getInstance(anchorModules.first().project).perModuleOutOfCodeBlockTrackerUpdater - return anchorModules.maxOfOrNull { modificationCountUpdater.getModificationCount(it) } - ?: ModificationTracker.NEVER_CHANGED.modificationCount - } -} diff --git a/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/caches/trackers/modificationTrackerUtil.kt b/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/caches/trackers/modificationTrackerUtil.kt new file mode 100644 index 00000000000..969e102a65b --- /dev/null +++ b/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/caches/trackers/modificationTrackerUtil.kt @@ -0,0 +1,19 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.caches.trackers + +import com.intellij.openapi.module.Module +import com.intellij.openapi.util.ModificationTracker + +fun getLatestModificationCount(modules: Collection): Long { + if (modules.isEmpty()) + return ModificationTracker.NEVER_CHANGED.modificationCount + + val modificationCountUpdater = + KotlinCodeBlockModificationListener.getInstance(modules.first().project).perModuleOutOfCodeBlockTrackerUpdater + return modules.maxOfOrNull { modificationCountUpdater.getModificationCount(it) } + ?: ModificationTracker.NEVER_CHANGED.modificationCount +}