ErrorReporter is now Java-independent

This commit is contained in:
Andrey Breslav
2015-03-04 18:04:43 +03:00
parent 266485add3
commit 36bbd2c0e3
16 changed files with 55 additions and 28 deletions
@@ -20,6 +20,8 @@ import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.load.java.JvmAbi
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.serialization.deserialization.ErrorReporter
public object RuntimeErrorReporter : ErrorReporter {
// TODO: specialized exceptions
@@ -27,8 +29,8 @@ public object RuntimeErrorReporter : ErrorReporter {
throw IllegalStateException("Incomplete hierarchy for class ${descriptor.getName()}, unresolved classes $unresolvedSuperClasses")
}
override fun reportIncompatibleAbiVersion(kotlinClass: KotlinJvmBinaryClass, actualVersion: Int) {
throw IllegalStateException("Incompatible ABI version of ${kotlinClass.getClassId()}: $actualVersion " +
override fun reportIncompatibleAbiVersion(classId: ClassId, filePath: String, actualVersion: Int) {
throw IllegalStateException("Incompatible ABI version of ${classId}: $actualVersion " +
"(expected version is ${JvmAbi.VERSION})")
}
@@ -43,7 +43,9 @@ public class ReflectKotlinClass private(
private val klass: Class<*>,
private val classHeader: KotlinClassHeader
) : KotlinJvmBinaryClass {
default object Factory {
public fun create(klass: Class<*>): ReflectKotlinClass? {
val headerReader = ReadKotlinClassHeaderAnnotationVisitor()
ReflectClassStructure.loadClassAnnotations(klass, headerReader)
@@ -51,6 +53,8 @@ public class ReflectKotlinClass private(
}
}
override fun getLocation() = klass.getName().replace('.', '/') + ".class"
override fun getClassId() = klass.classId
override fun getClassHeader() = classHeader