Nullable classes


I have a method:

fun install<T:Any?>(instance: T, clazz: Class<T>)

which, I am trying to call like this:

fun installString(value: String?) {
  install(value, javaClass<String?>())

But it’s not working. The error is:

Error: Kotlin: Type argument is not within its bounds: should be subtype of ‘kotlin.Any’

Which I don’t quite understand, since I’m trying to explicitly allow for nullable types. This was working fine in M7, but when I’ve updated to M9, this is no longer working. Please advise.


The error is on String? type argument of javaClass: the latter requires not null.