Use JvmMetadataVersion where appropriate instead of bytecode version
This commit is contained in:
@@ -567,7 +567,7 @@
|
||||
<psi.classFileDecompiler implementation="org.jetbrains.kotlin.idea.decompiler.js.KotlinJavaScriptMetaFileDecompiler"/>
|
||||
<psi.classFileDecompiler implementation="org.jetbrains.kotlin.idea.decompiler.builtIns.KotlinBuiltInDecompiler"/>
|
||||
|
||||
<fileBasedIndex implementation="org.jetbrains.kotlin.idea.versions.KotlinAbiVersionIndex"/>
|
||||
<fileBasedIndex implementation="org.jetbrains.kotlin.idea.versions.KotlinMetadataVersionIndex"/>
|
||||
<fileBasedIndex implementation="org.jetbrains.kotlin.idea.versions.KotlinJavaScriptAbiVersionIndex"/>
|
||||
<fileBasedIndex implementation="org.jetbrains.kotlin.idea.vfilefinder.KotlinClassFileIndex"/>
|
||||
<fileBasedIndex implementation="org.jetbrains.kotlin.idea.vfilefinder.KotlinJavaScriptMetaFileIndex"/>
|
||||
|
||||
+6
-6
@@ -22,15 +22,15 @@ import com.intellij.util.indexing.FileBasedIndex
|
||||
import com.intellij.util.indexing.FileContent
|
||||
import org.jetbrains.kotlin.codegen.AsmUtil.asmDescByFqNameWithoutInnerClasses
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames.*
|
||||
import org.jetbrains.kotlin.load.java.JvmBytecodeBinaryVersion
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmMetadataVersion
|
||||
import org.jetbrains.kotlin.serialization.deserialization.BinaryVersion
|
||||
import org.jetbrains.org.objectweb.asm.AnnotationVisitor
|
||||
import org.jetbrains.org.objectweb.asm.ClassReader
|
||||
import org.jetbrains.org.objectweb.asm.ClassVisitor
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
|
||||
object KotlinAbiVersionIndex : KotlinAbiVersionIndexBase<KotlinAbiVersionIndex>(
|
||||
KotlinAbiVersionIndex::class.java, { JvmBytecodeBinaryVersion.create(it) }
|
||||
object KotlinMetadataVersionIndex : KotlinAbiVersionIndexBase<KotlinMetadataVersionIndex>(
|
||||
KotlinMetadataVersionIndex::class.java, { JvmMetadataVersion.create(it) }
|
||||
) {
|
||||
override fun getIndexer() = INDEXER
|
||||
|
||||
@@ -38,7 +38,7 @@ object KotlinAbiVersionIndex : KotlinAbiVersionIndexBase<KotlinAbiVersionIndex>(
|
||||
|
||||
override fun getVersion() = VERSION
|
||||
|
||||
private val VERSION = 2
|
||||
private val VERSION = 3
|
||||
|
||||
private val kotlinAnnotationsDesc = setOf(
|
||||
KOTLIN_CLASS,
|
||||
@@ -61,7 +61,7 @@ object KotlinAbiVersionIndex : KotlinAbiVersionIndexBase<KotlinAbiVersionIndex>(
|
||||
return object : AnnotationVisitor(Opcodes.ASM5) {
|
||||
override fun visit(name: String, value: Any) {
|
||||
if (name == VERSION_FIELD_NAME && value is IntArray) {
|
||||
version = JvmBytecodeBinaryVersion.create(value)
|
||||
version = JvmMetadataVersion.create(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ object KotlinAbiVersionIndex : KotlinAbiVersionIndexBase<KotlinAbiVersionIndex>(
|
||||
|
||||
if (annotationPresent && version == null) {
|
||||
// No version at all because the class is too old, or version is set to something weird
|
||||
version = JvmBytecodeBinaryVersion.INVALID_VERSION
|
||||
version = JvmMetadataVersion.INVALID_VERSION
|
||||
}
|
||||
|
||||
if (version != null) mapOf(version!! to null) else mapOf()
|
||||
@@ -69,7 +69,7 @@ public class KotlinRuntimeLibraryUtil {
|
||||
@NotNull
|
||||
public static Collection<VirtualFile> getLibraryRootsWithAbiIncompatibleKotlinClasses(@NotNull Project project) {
|
||||
return getLibraryRootsWithAbiIncompatibleVersion(
|
||||
project, KotlinAbiVersionIndex.INSTANCE,
|
||||
project, KotlinMetadataVersionIndex.INSTANCE,
|
||||
new Function1<Module, Boolean>() {
|
||||
@Override
|
||||
public Boolean invoke(@Nullable Module module) {
|
||||
|
||||
@@ -62,7 +62,7 @@ class KotlinUpdatePluginComponent : ApplicationComponent {
|
||||
|
||||
// Force update indices for files under config directory
|
||||
val fileBasedIndex = FileBasedIndex.getInstance()
|
||||
fileBasedIndex.requestRebuild(KotlinAbiVersionIndex.name)
|
||||
fileBasedIndex.requestRebuild(KotlinMetadataVersionIndex.name)
|
||||
fileBasedIndex.requestRebuild(KotlinJavaScriptAbiVersionIndex.name)
|
||||
fileBasedIndex.requestRebuild(KotlinClassFileIndex.KEY)
|
||||
fileBasedIndex.requestRebuild(KotlinJavaScriptMetaFileIndex.KEY)
|
||||
|
||||
Reference in New Issue
Block a user