Minor, inline unneeded JvmDependenciesIndexFactory
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -48,13 +48,3 @@ data class JavaRoot(val file: VirtualFile, val type: RootType, val prefixFqName:
|
||||
val SourceAndBinary: Set<RootType> = EnumSet.of(RootType.BINARY, RootType.SOURCE)
|
||||
}
|
||||
}
|
||||
|
||||
interface JvmDependenciesIndexFactory<out T : JvmDependenciesIndex> {
|
||||
fun makeIndexFor(roots: List<JavaRoot>): T
|
||||
}
|
||||
|
||||
class JvmUpdateableDependenciesIndexFactory : JvmDependenciesIndexFactory<JvmDependenciesDynamicCompoundIndex> {
|
||||
override fun makeIndexFor(roots: List<JavaRoot>) = JvmDependenciesDynamicCompoundIndex().apply {
|
||||
addIndex(JvmDependenciesIndexImpl(roots))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user