Do not cache contents in VFS when reading contents of .jar files

This follows the standard IDEA policy of caching file contents.
This commit is contained in:
Dmitry Jemerov
2017-03-14 13:05:56 +01:00
parent 8d1d76cdae
commit e037e9de39
4 changed files with 4 additions and 4 deletions
@@ -48,7 +48,7 @@ class ClsJavaStubByVirtualFileCache {
if (file.fileType !== JavaClassFileType.INSTANCE) return null
try {
return ClsFileImpl.buildFileStub(file, file.contentsToByteArray())
return ClsFileImpl.buildFileStub(file, file.contentsToByteArray(false))
}
catch (e: ClsFormatException) {
LOG.error("Failed to build java cls class for " + file.canonicalPath!!, e)
@@ -72,7 +72,7 @@ abstract class KotlinMetadataDecompiler<out V : BinaryVersion>(
if (!file.isValid) return null
return try {
readFile(file.contentsToByteArray(), file)
readFile(file.contentsToByteArray(false), file)
}
catch (e: IOException) {
// This is needed because sometimes we're given VirtualFile instances that point to non-existent .jar entries.
@@ -141,7 +141,7 @@ private fun readClassFileImpl(project: Project,
val fileFinder = VirtualFileFinder.getInstance(project)
val classFile = fileFinder.findVirtualFileWithHeader(classId) ?: return null
return classFile.contentsToByteArray()
return classFile.contentsToByteArray(false)
}
fun readFromOutput(isForTestClasses: Boolean): ByteArray? {
@@ -69,7 +69,7 @@ class KotlinDecompilerServiceImpl : KotlinDecompilerService {
}.map { it.path to it }
return files.entries.associate {
Pair(File(it.key), { it.value.contentsToByteArray() })
Pair(File(it.key), { it.value.contentsToByteArray(false) })
}
}