08/29/2018, 8:43 AM
I am working with an abstract class without an interface I have no control over, and it has a lot of generic methods but the class itself doesn't use a generic type signature. I am trying to use a typealias to give it a type, but the type isn't enforced. Example:
Copy code
class A {
    fun <T> a(v: T): TypedA<T> = this

typealias TypedA<T> = A

fun main(args: Array<String>) {
    val result = A().a("hello") // inferred type: TypedA<String>
    val result2: TypedA<Int> = A().a("hello") // <Int>, this is legal
Is there any way to enforce the type