Generic type leads to invalid generated code
See original GitHub issueHere’s an example of type parameterized model:
@JsonSerializable
data class PagedResult<out Data>(val data: List<Data>, val meta: MetaData) {
@JsonSerializable
data class MetaData(val total: Int,
val count: Int,
@Json(name = "per_page")
val resultsPerPage: Int,
@Json(name = "current_page")
val currentPage: Int,
@Json(name = "total_pages")
val totalPages: Int)
}
The generated code attempts to refer to Data.class
which is incorrect since it’s a type parameter.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
c# - Generic Type InvalidOperationException - Stack Overflow
Your problem is related to covariance & contravariance. In some cases we can have a solution by declaring the view model abstract as ......
Read more >[BUG] [JAVA] Generic type generates invalid equals body #3808
[BUG] [JAVA] Generic type generates invalid equals body #3808 ... and it generates equals method of this object containing this line.
Read more >Restrictions on Generics (The Java™ Tutorials > Learning the ...
Because the Java compiler erases all type parameters in generic code, you cannot verify which parameterized type for a generic type is being...
Read more >Web service error codes (Microsoft Dataverse) - Power Apps
Message: An Invalid type code was specified by the throwing method. 0x80043512 ... Message: The calculation failed due to an overflow error.
Read more >Bug Patterns - Error Prone
Each bug pattern includes code examples of both positive and negative cases; ... Passing argument to a generic method with an incompatible type....
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 Free
Top 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
This has been fixed and released in beta3
A PR has been opened in #42