haha, unfortunately I can't think of any simple ways to actually get that to work. Might be easier to just define a Kotlin convenience function at this point:
Copy code
fun <T: Any> T?.asOptional(): Optional<T> {
return Optional.ofNullable<T>(this)
}