mwerschy
01/05/2018, 4:28 PMCannot access 'clazz': it is private/*private to this*/ in 'Test'
?
class Test<out T>(private val clazz: Class<@UnsafeVariance T>) {
companion object {
fun test(test: Test<*>) = test.clazz
}
}
Making clazz
public or making T
invariant fixes the error but I'd prefer to avoid that. Companion objects should have access to private members so this should work as is.yaakov
01/05/2018, 5:04 PMmwerschy
01/05/2018, 5:34 PMclazz
. I don't see how changing the constructor visibility would affect that.yaakov
01/05/2018, 5:35 PMclass Test<out T> private constructor(val clazz: Class<@UnsafeVariance T>) {
companion object {
fun test(test: Test<*>) = test.clazz
}
}
mwerschy
01/05/2018, 5:36 PM