-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make $serializer generic constructor public
If a serializable class has generic type parameters, its serializer is not an object and has a specialized constructor. This constructor was public in K1 and should be public in K2 so it can be called from other serializable classes (in case class is e.g., part of sealed hierarchy). #KT-63402 Fixed
- Loading branch information
1 parent
51e3e9a
commit 662bff7
Showing
6 changed files
with
43 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
plugins/kotlinx-serialization/testData/boxIr/sealedClassMultifile.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// TARGET_BACKEND: JVM_IR | ||
|
||
// WITH_STDLIB | ||
|
||
// FILE: a.kt | ||
|
||
import kotlinx.serialization.* | ||
|
||
@Serializable | ||
sealed class Base { | ||
abstract val id: Long | ||
} | ||
|
||
// FILE: b.kt | ||
|
||
import kotlinx.serialization.* | ||
import kotlinx.serialization.descriptors.* | ||
|
||
@Serializable | ||
class DerivedOtherFile<Value>( | ||
override val id: Long, | ||
val value: Value | ||
) : Base() | ||
|
||
fun box(): String { | ||
val desc = Base.serializer().descriptor.kind | ||
return if (desc == PolymorphicKind.SEALED) "OK" else desc.toString() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...tbrains/kotlinx/serialization/runners/SerializationFirLightTreeBlackBoxTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
...ests-gen/org/jetbrains/kotlinx/serialization/runners/SerializationIrBoxTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.