https://kotlinlang.org logo
Title
a

Ayden

11/26/2019, 4:36 PM
If there any difference between
Java::class.java
and
Java::class
? Why sometime I need to passing the first option as a parameter but sometime I need to pass the second option?
l

Luca Nicoletti

11/26/2019, 4:37 PM
::class
is of type
KClass
::class.java
is of type
Class
depending on which your function requires, you need to provide the correct one
👍 2
c

Casey Brooks

11/26/2019, 4:37 PM
The first one is only available on the JVM platform. It is the
Class<>
you’d normally use for JVM reflection. The second is a
KClass<>
, used for Kotlin-specific reflection, and is available on all platforms (including Native and JS), albeit with limited reflection functionality
👍 5
a

Ayden

11/26/2019, 4:40 PM
Understand now. Thank you @Luca Nicoletti and @Casey Brooks
l

Luca Nicoletti

11/26/2019, 4:40 PM
@Casey Brooks was more specific 😄