Add checker for companion objects inside serializable class:
Warning for old FE, error in FIR #KT-54441 Fixed Merged-by: Leonid Startsev <leonid.startsev@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
3832c6a520
commit
4cf50d7d23
@@ -3,7 +3,7 @@
|
||||
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
<!COMPANION_OBJECT_AS_CUSTOM_SERIALIZER_DEPRECATED!>@Serializable<!>
|
||||
class Digest() {
|
||||
@Serializer(forClass = Digest::class)
|
||||
companion object : KSerializer<Digest> {}
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
// FIR_IDENTICAL
|
||||
// SKIP_TXT
|
||||
|
||||
// FILE: test.kt
|
||||
import kotlinx.serialization.*
|
||||
|
||||
class Bar
|
||||
|
||||
<!COMPANION_OBJECT_AS_CUSTOM_SERIALIZER_DEPRECATED!>@Serializable<!>
|
||||
class Foo1 {
|
||||
@Serializer(Foo1::class)
|
||||
companion object
|
||||
}
|
||||
|
||||
@Serializable
|
||||
class Foo2 {
|
||||
<!COMPANION_OBJECT_SERIALIZER_INSIDE_OTHER_SERIALIZABLE_CLASS!>@Serializer(Bar::class)<!>
|
||||
companion object
|
||||
}
|
||||
|
||||
@Serializer(Foo3::class)
|
||||
object Foo3Ser
|
||||
|
||||
@Serializable(Foo3Ser::class)
|
||||
class Foo3 {
|
||||
<!COMPANION_OBJECT_SERIALIZER_INSIDE_OTHER_SERIALIZABLE_CLASS!>@Serializer(Bar::class)<!>
|
||||
companion object
|
||||
}
|
||||
|
||||
@Serializable(Foo4.Companion::class)
|
||||
class Foo4 {
|
||||
@Serializer(Foo4::class)
|
||||
companion object
|
||||
}
|
||||
|
||||
class NonSerializableFoo {
|
||||
<!COMPANION_OBJECT_SERIALIZER_INSIDE_NON_SERIALIZABLE_CLASS!>@Serializer(Bar::class)<!>
|
||||
companion object
|
||||
}
|
||||
Reference in New Issue
Block a user