I really see Kotlin as very likely to be my preferred jvm language for the next 10 years (with the virtually seemless java interop the key).
For me, I’m seeing Foo::class.java pop up enough times for me to think ‘gee it would be nice if that was more clean / seemless’. I am seeing this in dependency injection a lot but you get the odd time class literals are used to support generics (and yes sometimes you can use the subclass trick there to avoid needing to pass the class literal). I’m not expected (nor asking for) reified generics so in that sense I see the java class literal being used in these cases for some time.
Ideally I’d just like to see a more succinct syntax that ideally didn’t require kotlin-reflect.
If simplier java class literals is possible and deemed a good idea some syntax thoughts are:
Foo::jclass … ::jclass, I’d be happy with this
- Foo::klass and Foo::class … for kotlin class and java class respectively. Changing kotlin class from ::class to ::klass would require migration
Foo … groovy style, probably not a good idea