17
17
package org.jetbrains.kotlin.idea.decompiler
18
18
19
19
import com.intellij.ide.highlighter.JavaClassFileType
20
- import com.intellij.openapi.util.Key
21
20
import com.intellij.openapi.vfs.VirtualFile
22
21
import com.intellij.psi.ClassFileViewProvider
23
22
import org.jetbrains.kotlin.idea.caches.JarUserDataManager
@@ -28,7 +27,6 @@ import org.jetbrains.kotlin.load.kotlin.KotlinBinaryClassCache
28
27
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass
29
28
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
30
29
import org.jetbrains.kotlin.name.ClassId
31
- import org.jetbrains.kotlin.name.FqName
32
30
import org.jetbrains.kotlin.name.Name
33
31
34
32
/* *
@@ -73,8 +71,15 @@ public fun isKotlinInternalCompiledFile(file: VirtualFile): Boolean {
73
71
if (ClassFileViewProvider .isInnerClass(file)) {
74
72
return true
75
73
}
76
- val header = KotlinBinaryClassCache .getKotlinBinaryClass(file)?.getClassHeader() ? : return false
77
- return (header.kind == KotlinClassHeader .Kind .SYNTHETIC_CLASS && header.syntheticClassKind != KotlinSyntheticClass .Kind .PACKAGE_PART ) ||
74
+ val header = KotlinBinaryClassCache .getKotlinBinaryClass(file)?.classHeader ? : return false
75
+
76
+ if (header.syntheticClassKind == KotlinSyntheticClass .Kind .PACKAGE_PART ) {
77
+ // Old package parts should not be decompiled and shown anywhere
78
+ val version = header.version
79
+ return version.major < 0 || (version.major == 0 && version.minor < 24 )
80
+ }
81
+
82
+ return header.kind == KotlinClassHeader .Kind .SYNTHETIC_CLASS ||
78
83
(header.kind == KotlinClassHeader .Kind .CLASS && header.classKind != null && header.classKind != KotlinClass .Kind .CLASS ) ||
79
84
(header.kind == KotlinClassHeader .Kind .MULTIFILE_CLASS_PART )
80
85
}
0 commit comments