Extract isCompatibleAbiVersion from kinds enum and store read kinds even for incompatible version
This commit is contained in:
@@ -27,6 +27,7 @@ public fun isKotlinCompiledFile(file: VirtualFile): Boolean {
|
||||
if (isKotlinCompiledFileWithIncompatibleAbiVersion(file)) {
|
||||
return false
|
||||
}
|
||||
|
||||
val header = KotlinBinaryClassCache.getKotlinBinaryClass(file)?.getClassHeader()
|
||||
return header != null && header.syntheticClassKind != KotlinSyntheticClass.Kind.TRAIT_IMPL
|
||||
}
|
||||
@@ -36,7 +37,7 @@ public fun isKotlinCompiledFileWithIncompatibleAbiVersion(file: VirtualFile): Bo
|
||||
return false
|
||||
}
|
||||
val header = KotlinBinaryClassCache.getKotlinBinaryClass(file)?.getClassHeader()
|
||||
return header?.kind == KotlinClassHeader.Kind.INCOMPATIBLE_ABI_VERSION
|
||||
return header != null && !header.isCompatibleAbiVersion
|
||||
}
|
||||
|
||||
public fun isKotlinInternalCompiledFile(file: VirtualFile): Boolean {
|
||||
|
||||
+6
-1
@@ -40,8 +40,13 @@ public fun buildDecompiledText(
|
||||
val kotlinClass = KotlinBinaryClassCache.getKotlinBinaryClass(classFile)
|
||||
assert(kotlinClass != null) { "Decompiled data factory shouldn't be called on an unsupported file: " + classFile }
|
||||
val classId = kotlinClass!!.getClassId()
|
||||
val classHeader = kotlinClass.getClassHeader()
|
||||
val kind = kotlinClass.getClassHeader().kind
|
||||
val packageFqName = classId.getPackageFqName()
|
||||
|
||||
if (!classHeader.isCompatibleAbiVersion) {
|
||||
throw UnsupportedOperationException("Illegal operation for incompatibel header")
|
||||
}
|
||||
|
||||
return if (kind == KotlinClassHeader.Kind.PACKAGE_FACADE) {
|
||||
buildDecompiledText(packageFqName, ArrayList(resolver.resolveDeclarationsInPackage(packageFqName)))
|
||||
@@ -83,7 +88,7 @@ private fun buildDecompiledText(packageFqName: FqName, descriptors: List<Declara
|
||||
}
|
||||
|
||||
fun sortDeclarations(input: Collection<DeclarationDescriptor>): List<DeclarationDescriptor> {
|
||||
val r = ArrayList<DeclarationDescriptor>(input)
|
||||
val r = ArrayList(input)
|
||||
Collections.sort(r, MemberComparator.INSTANCE)
|
||||
return r
|
||||
}
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ public final class KotlinClassFileIndex extends ScalarIndexExtension<FqName> {
|
||||
public Map<FqName, Void> map(@NotNull FileContent inputData) {
|
||||
try {
|
||||
KotlinJvmBinaryClass kotlinClass = KotlinBinaryClassCache.getKotlinBinaryClass(inputData.getFile());
|
||||
if (kotlinClass != null && kotlinClass.getClassHeader().getKind() != KotlinClassHeader.Kind.INCOMPATIBLE_ABI_VERSION) {
|
||||
if (kotlinClass != null && kotlinClass.getClassHeader().getIsCompatibleAbiVersion()) {
|
||||
return Collections.singletonMap(kotlinClass.getClassId().asSingleFqName().toSafe(), null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user