Do not decompile old incompatible package parts
Fix the test by reverting 282727b
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.idea.decompiler
|
||||
|
||||
import com.intellij.ide.highlighter.JavaClassFileType
|
||||
import com.intellij.openapi.util.Key
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.ClassFileViewProvider
|
||||
import org.jetbrains.kotlin.idea.caches.JarUserDataManager
|
||||
@@ -28,7 +27,6 @@ import org.jetbrains.kotlin.load.kotlin.KotlinBinaryClassCache
|
||||
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass
|
||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
/**
|
||||
@@ -73,8 +71,15 @@ public fun isKotlinInternalCompiledFile(file: VirtualFile): Boolean {
|
||||
if (ClassFileViewProvider.isInnerClass(file)) {
|
||||
return true
|
||||
}
|
||||
val header = KotlinBinaryClassCache.getKotlinBinaryClass(file)?.getClassHeader() ?: return false
|
||||
return (header.kind == KotlinClassHeader.Kind.SYNTHETIC_CLASS && header.syntheticClassKind != KotlinSyntheticClass.Kind.PACKAGE_PART) ||
|
||||
val header = KotlinBinaryClassCache.getKotlinBinaryClass(file)?.classHeader ?: return false
|
||||
|
||||
if (header.syntheticClassKind == KotlinSyntheticClass.Kind.PACKAGE_PART) {
|
||||
// Old package parts should not be decompiled and shown anywhere
|
||||
val version = header.version
|
||||
return version.major < 0 || (version.major == 0 && version.minor < 24)
|
||||
}
|
||||
|
||||
return header.kind == KotlinClassHeader.Kind.SYNTHETIC_CLASS ||
|
||||
(header.kind == KotlinClassHeader.Kind.CLASS && header.classKind != null && header.classKind != KotlinClass.Kind.CLASS) ||
|
||||
(header.kind == KotlinClassHeader.Kind.MULTIFILE_CLASS_PART)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user