Prohibit serializable annotation on local classes and anonymous objects
#KT-45541 Fixed
This commit is contained in:
plugins/kotlin-serialization/kotlin-serialization-compiler/testData/diagnostics/LocalAndAnonymous.kt
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE
|
||||
// WITH_RUNTIME
|
||||
// SKIP_TXT
|
||||
|
||||
import kotlinx.serialization.*
|
||||
|
||||
fun container() {
|
||||
<!LOCAL_CLASSES_NOT_SUPPORTED!>@Serializable<!>
|
||||
class X
|
||||
|
||||
val y = <!LOCAL_CLASSES_NOT_SUPPORTED!>@Serializable<!> object {}
|
||||
}
|
||||
|
||||
val topLevelAnon = <!LOCAL_CLASSES_NOT_SUPPORTED!>@Serializable<!> object {}
|
||||
|
||||
@Serializable class A {
|
||||
@Serializable class B // nesting classes are allowed
|
||||
}
|
||||
Reference in New Issue
Block a user