receiveOrNull susceptible to type erasure
See original GitHub issueThe highlighted code is susceptible to type erasure. If I want to receiveOrNull<Map<String, List<String>>>()
, for instance, at runtime I will only have access to Map<*, *>::class
. This is a problem for a lot of serializations frameworks, like jackson, who use TypeToken
s or the like.
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
unable to use ktor-client with jackson and collections #346
The problem I am encountering is with the suspend inline fun HttpClient.get() function. When the reified T is a List , the type...
Read more >Understand Kotlin Reified and Type Erasure - Level Up Coding
In Java, and other programming languages, there's a concept known as type erasure. This means that when code is compiled, the type is...
Read more >Generics and Overcoming Type Erasure on the JVM - Stackify
This is called type erasure, because parameterized types are “erased”. Generics are enforced at compile-time by the compiler itself. For example ...
Read more >Using Type Erasure to Build a Dependency Injecting Routing ...
Type erasures often only have the initializer exposed -- all usage is controlled internally to guarantee the force-unwraps will never fail. In ...
Read more >Type Erasure - ModernesCpp.com
Type erasure based on templates is a pretty sophisticated technique. It allows you to bridge dynamic polymorphism (object orientation) with ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tylerbobella Same thing happens with Gson as well. And for workaround, well you can still take the whole string and convert it with jackson/gson manually.
With Gson, instead of:
use
You can write extension function and make it look prettier.
Since 1.3.0
KType
is available (fromtypeOf(
) and kotlinx.serialization support should work as well. You may check it in version1.3.0-rc