Get rid of another map built in FastJarHandler
This commit is contained in:
committed by
teamcityserver
parent
42b2605c2a
commit
2266a348c3
@@ -31,7 +31,6 @@ class FastJarHandler(val fileSystem: FastJarFileSystem, path: String) {
|
||||
}
|
||||
}
|
||||
|
||||
val childrenMap = HashMap<FastJarVirtualFile, MutableList<VirtualFile>>(ourEntryMap.size)
|
||||
myRoot = FastJarVirtualFile(this, "", -1, null)
|
||||
|
||||
val filesByRelativePath = HashMap<String, FastJarVirtualFile>(ourEntryMap.size)
|
||||
@@ -41,13 +40,8 @@ class FastJarHandler(val fileSystem: FastJarFileSystem, path: String) {
|
||||
getOrCreateFile(info, filesByRelativePath)
|
||||
}
|
||||
|
||||
for (child in filesByRelativePath.values) {
|
||||
val parent = child.parent as? FastJarVirtualFile ?: continue
|
||||
childrenMap.getOrPut(parent) { mutableListOf() }.add(child)
|
||||
}
|
||||
|
||||
for ((key, childList) in childrenMap) {
|
||||
key.children = childList.toTypedArray()
|
||||
for (node in filesByRelativePath.values) {
|
||||
node.initChildrenArrayFromList()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,12 +17,19 @@ internal class FastJarVirtualFile(
|
||||
private val myHandler: FastJarHandler,
|
||||
private val myName: CharSequence,
|
||||
private val myLength: Int,
|
||||
private val myParent: VirtualFile?
|
||||
private val myParent: FastJarVirtualFile?
|
||||
) : VirtualFile() {
|
||||
|
||||
private var myChildren = EMPTY_ARRAY
|
||||
fun setChildren(children: Array<VirtualFile>) {
|
||||
myChildren = children
|
||||
private var myChildrenArray = EMPTY_ARRAY
|
||||
private val myChildrenList: MutableList<VirtualFile> = mutableListOf()
|
||||
|
||||
init {
|
||||
myParent?.myChildrenList?.add(this)
|
||||
}
|
||||
|
||||
fun initChildrenArrayFromList() {
|
||||
myChildrenArray = myChildrenList.toTypedArray()
|
||||
myChildrenList.clear()
|
||||
}
|
||||
|
||||
override fun getName(): String {
|
||||
@@ -68,7 +75,7 @@ internal class FastJarVirtualFile(
|
||||
}
|
||||
|
||||
override fun getChildren(): Array<VirtualFile> {
|
||||
return myChildren
|
||||
return myChildrenArray
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
|
||||
Reference in New Issue
Block a user