-
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.
Skip properties from Java classes for which the getter type is unknown
thus avoiding NPE when auto-generating external serializers. #KT-55681 Fixed
- Loading branch information
1 parent
a1894ed
commit 0b4f534
Showing
4 changed files
with
41 additions
and
1 deletion.
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/externalSerialierJava.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 | ||
|
||
import kotlinx.serialization.* | ||
import kotlinx.serialization.descriptors.* | ||
import kotlinx.serialization.encoding.* | ||
import java.net.URL | ||
|
||
|
||
// @Serializer should do nothing if all methods are overriden | ||
@Serializer(forClass = URL::class) | ||
object URLSerializer : KSerializer<URL> { | ||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("java.net.URL", PrimitiveKind.STRING) | ||
|
||
override fun serialize(encoder: Encoder, value: URL) { | ||
TODO() | ||
} | ||
|
||
override fun deserialize(decoder: Decoder): URL { | ||
TODO() | ||
} | ||
} | ||
|
||
fun box(): String { | ||
if (URLSerializer.descriptor.toString() != "PrimitiveDescriptor(java.net.URL)") return URLSerializer.descriptor.toString() | ||
return "OK" | ||
} |
6 changes: 6 additions & 0 deletions
6
...en/org/jetbrains/kotlinx/serialization/runners/SerializationFirBlackBoxTestGenerated.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.