Don't spam warning when file is empty

IDEA produces such files when class file had been removed from jar but indexes haven't been not fully reconstructed yet.
This commit is contained in:
Nikolay Krasko
2014-10-17 19:50:18 +04:00
parent 40bb8968cc
commit b58c5f7df4
@@ -52,8 +52,11 @@ public class VirtualFileKotlinClass private(
deprecated("Use KotlinBinaryClassCache")
fun create(file: VirtualFile): VirtualFileKotlinClass? {
assert(file.getFileType() == JavaClassFileType.INSTANCE) { "Trying to read binary data from a non-class file $file" }
val byteContent = file.contentsToByteArray()
if (byteContent.isEmpty()) return null
try {
return FileBasedKotlinClass.create(file.contentsToByteArray()) {
return FileBasedKotlinClass.create(byteContent) {
name, header, innerClasses ->
VirtualFileKotlinClass(file, name, header, innerClasses)
}