Support cross-module usages of @JvmRecord classes
The problem is that JvmRecord has SOURCE retention Probably, increasing its retention might be a more reliable solution (or in some other way serializing that the class is a record) Just checking supertypes seems like a reasonable approximation: only records kotlin are allowed to extend j.l.Record. But the relevant diagnostic has been added only since 1.4.30, so potentially there could have been exist a non-record class with such supertype compiled by 1.4.20, but this case seems to be ill-formed and marginal anyway. For Java classes, it's irrelevant since they don't have member properties (only synthetic extensions) ^KT-43677 In Progress
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// !API_VERSION: 1.5
|
||||
// !LANGUAGE: +JvmRecordSupport
|
||||
// JVM_TARGET: 15_PREVIEW
|
||||
// FILE: A.kt
|
||||
@JvmRecord
|
||||
data class MyRecord(val foo: String, val bar: String)
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
fun main() {
|
||||
val myRecord = MyRecord("O", "K")
|
||||
val s = myRecord.foo + myRecord.bar
|
||||
if (s != "OK") {
|
||||
throw AssertionError("fail: $s")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user