From fd0658e0f446d4a5cf472ea815e70117cb08b3fd Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Fri, 16 Jun 2017 18:02:50 +0300 Subject: [PATCH] Minor, inline unneeded JvmDependenciesIndexFactory --- .../kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt | 11 ++++++----- .../kotlin/cli/jvm/index/JvmDependenciesIndex.kt | 10 ---------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt index 11590da1595..77a360bcc56 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt @@ -203,13 +203,14 @@ class KotlinCoreEnvironment private constructor( ) } - // REPL and kapt2 update classpath dynamically - val indexFactory = JvmUpdateableDependenciesIndexFactory() - val (roots, singleJavaFileRoots) = initialRoots.partition { (file) -> file.isDirectory || file.extension != JavaFileType.DEFAULT_EXTENSION } - rootsIndex = indexFactory.makeIndexFor(roots) - updateClasspathFromRootsIndex(rootsIndex) + + // REPL and kapt2 update classpath dynamically + rootsIndex = JvmDependenciesDynamicCompoundIndex().apply { + addIndex(JvmDependenciesIndexImpl(roots)) + updateClasspathFromRootsIndex(this) + } (ServiceManager.getService(project, CoreJavaFileManager::class.java) as KotlinCliJavaFileManagerImpl).initialize( rootsIndex, diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/index/JvmDependenciesIndex.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/index/JvmDependenciesIndex.kt index c7b3ab3087f..760bfdb5c56 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/index/JvmDependenciesIndex.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/index/JvmDependenciesIndex.kt @@ -48,13 +48,3 @@ data class JavaRoot(val file: VirtualFile, val type: RootType, val prefixFqName: val SourceAndBinary: Set = EnumSet.of(RootType.BINARY, RootType.SOURCE) } } - -interface JvmDependenciesIndexFactory { - fun makeIndexFor(roots: List): T -} - -class JvmUpdateableDependenciesIndexFactory : JvmDependenciesIndexFactory { - override fun makeIndexFor(roots: List) = JvmDependenciesDynamicCompoundIndex().apply { - addIndex(JvmDependenciesIndexImpl(roots)) - } -}