The Reified Type parameters support run-time access to types passed to functions. I understand that this can be useful in certain scenarios to avoid reflection.
But there are examples of creating extension functions with reified type parameters which simply wrap T::class.java syntax in a method like below.
inline fun <reified T > Context.systemService() =
ContextCompat.getSystemService(this,T::class.java)
The kotlin reference mentions for the below usage the call-site is not pretty. Why is the following usage discouraged?
ContextCompat.getSystemService(this, NotificationManager::class.java)
Instead we can now write it like this :
systemService<NotificationManager>()
Are there any other benefits in such a scenario except that the code looks cleaner?
Note: the example is from I/O' 18