2.10.1 KSP generated adapters have trouble with generic typealiases when there is a default value
daviddenton opened this issue ยท 3 comments
daviddenton commented
Another edgecase ๐ .
Given the below:
typealias FooBar = List<String>
@JsonSerializable
data class Goo(
val Item: FooBar? = null
)
The generated "fromJson" method contains:
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor<Goo> = this.defaultConstructor ?:
Goo::class.java.getDeclaredConstructor(
FooBar::class.java, // should be: List::class.java
Int::class.javaPrimitiveType,
DefaultConstructorMarker::class.java
).also { this.defaultConstructor = it }
localConstructor.newInstance(
item,
mask,
/* DefaultConstructorMarker */ null
)
}
Error message is: Only classes are allowed on the left hand side of a class literal
ansman commented
A fix was just released in 2.10.2.
daviddenton commented
This now works like a charm! Thank you so much for the quick turnaround. ๐
ansman commented
No problem, let me know if there are any other issues ๐