Do not fail when deserializing incompatible metadata

Catch all exceptions when deserializing metadata with an incompatible version
to prevent the compiler from failing on discovering incompatible classes on the
classpath. Note that this is not the perfect solution: any invariant may be
broken in the incompatible metadata and it may result in a later exception
This commit is contained in:
Alexander Udalov
2016-12-07 21:30:26 +03:00
parent 789483e1eb
commit 830d2f6603
9 changed files with 172 additions and 12 deletions
@@ -0,0 +1,13 @@
package a
open class A {
class Nested
fun method() {}
val quux = ""
}
fun foo() {}
var bar = 42
typealias TA = String
@@ -0,0 +1,13 @@
compiler/testData/compileKotlinAgainstCustomBinaries/wrongMetadataVersionBadMetadata/source.kt:12:13: error: unresolved reference: foo
val x = foo()
^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongMetadataVersionBadMetadata/source.kt:13:13: error: unresolved reference: bar
val y = bar
^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongMetadataVersionBadMetadata/source.kt:14:5: error: unresolved reference: bar
bar = 239
^
compiler/testData/compileKotlinAgainstCustomBinaries/wrongMetadataVersionBadMetadata/source.kt:15:12: error: unresolved reference: TA
val z: TA = ""
^
COMPILATION_ERROR
@@ -0,0 +1,16 @@
package usage
import a.*
fun baz(param: A, nested: A.Nested) {
val constructor = A()
val nested = A.Nested()
val quux = param.getQuux()
val methodCall = param.method()
val supertype = object : A() {}
val x = foo()
val y = bar
bar = 239
val z: TA = ""
}