Extract isCompatibleAbiVersion from kinds enum and store read kinds even for incompatible version
Original commit: c242665cd3
This commit is contained in:
@@ -42,6 +42,8 @@ import org.jetbrains.jps.builders.storage.StorageProvider
|
||||
import java.io.IOException
|
||||
import java.util.Scanner
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmAbi
|
||||
import org.jetbrains.jet.lang.resolve.kotlin.header.isCompatiblePackageFacadeKind
|
||||
import org.jetbrains.jet.lang.resolve.kotlin.header.isCompatibleClassKind
|
||||
|
||||
val INLINE_ANNOTATION_DESC = "Lkotlin/inline;"
|
||||
|
||||
@@ -106,11 +108,11 @@ public class IncrementalCacheImpl(val baseDir: File): StorageOwner, IncrementalC
|
||||
val annotationDataEncoded = header.annotationData
|
||||
if (annotationDataEncoded != null) {
|
||||
val data = BitEncoding.decodeBytes(annotationDataEncoded)
|
||||
when (header.kind) {
|
||||
KotlinClassHeader.Kind.PACKAGE_FACADE -> {
|
||||
when {
|
||||
header.isCompatiblePackageFacadeKind() -> {
|
||||
return if (protoMap.put(className, data)) COMPILE_OTHERS else DO_NOTHING
|
||||
}
|
||||
KotlinClassHeader.Kind.CLASS -> {
|
||||
header.isCompatibleClassKind() -> {
|
||||
val inlinesChanged = inlineFunctionsMap.process(className, fileBytes)
|
||||
val protoChanged = protoMap.put(className, data)
|
||||
val constantsChanged = constantsMap.process(className, fileBytes)
|
||||
@@ -118,7 +120,7 @@ public class IncrementalCacheImpl(val baseDir: File): StorageOwner, IncrementalC
|
||||
return if (inlinesChanged) RECOMPILE_ALL else if (protoChanged || constantsChanged) COMPILE_OTHERS else DO_NOTHING
|
||||
}
|
||||
else -> {
|
||||
throw IllegalStateException("Unexpected kind with annotationData: ${header.kind}")
|
||||
throw IllegalStateException("Unexpected kind with annotationData: ${header.kind}, isCompatible: ${header.isCompatibleAbiVersion}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@ import java.io.ByteArrayInputStream
|
||||
import org.jetbrains.jet.descriptors.serialization.DebugProtoBuf
|
||||
import java.util.Arrays
|
||||
import org.jetbrains.jet.jps.incremental.LocalFileKotlinClass
|
||||
import org.jetbrains.jet.lang.resolve.kotlin.header.isCompatibleClassKind
|
||||
import org.jetbrains.jet.lang.resolve.kotlin.header.isCompatiblePackageFacadeKind
|
||||
|
||||
// Set this to true if you want to dump all bytecode (test will fail in this case)
|
||||
val DUMP_ALL = System.getProperty("comparison.dump.all") == "true"
|
||||
@@ -140,11 +142,11 @@ fun classFileToString(classFile: File): String {
|
||||
out.write("\n------ simpleNames proto -----\n${DebugProtoBuf.StringTable.parseDelimitedFrom(input)}")
|
||||
out.write("\n------ qualifiedNames proto -----\n${DebugProtoBuf.QualifiedNameTable.parseDelimitedFrom(input)}")
|
||||
|
||||
when (classHeader!!.kind) {
|
||||
KotlinClassHeader.Kind.PACKAGE_FACADE ->
|
||||
when {
|
||||
classHeader!!.isCompatiblePackageFacadeKind() ->
|
||||
out.write("\n------ package proto -----\n${DebugProtoBuf.Package.parseFrom(input, getExtensionRegistry())}")
|
||||
|
||||
KotlinClassHeader.Kind.CLASS ->
|
||||
classHeader.isCompatibleClassKind() ->
|
||||
out.write("\n------ class proto -----\n${DebugProtoBuf.Class.parseFrom(input, getExtensionRegistry())}")
|
||||
|
||||
else -> throw IllegalStateException()
|
||||
|
||||
Reference in New Issue
Block a user