-
Notifications
You must be signed in to change notification settings - Fork 630
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Being thrown on an attempt to retrieve serializer for some private implementation classes from stdlib. Fixes #2449
- Loading branch information
1 parent
919062f
commit b44f03f
Showing
4 changed files
with
82 additions
and
11 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
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
17 changes: 17 additions & 0 deletions
17
formats/json-tests/jvmTest/src/kotlinx/serialization/test/TypeToken.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,17 @@ | ||
/* | ||
* Copyright 2017-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package kotlinx.serialization.test | ||
|
||
import java.lang.reflect.* | ||
|
||
|
||
@PublishedApi | ||
internal open class TypeBase<T> | ||
|
||
public inline fun <reified T> typeTokenOf(): Type { | ||
val base = object : TypeBase<T>() {} | ||
val superType = base::class.java.genericSuperclass!! | ||
return (superType as ParameterizedType).actualTypeArguments.first()!! | ||
} |