Passing java class as parameter


I’m trying to convert a portion of a java codebase to Kotlin. The core framework will still be java so I’m trying figure out how to call the java function from a Kotlin class.

The java interface for the function is:

Integer get(Class<? extends SomeInterface> clazz);

The way to call it in java would be:


(SomeClass is an implementation of SomeInterface, both written in Java)

From Kotlin I would assume the call should look like


but I am getting the error:

None of the following functions can be called with the arguments supplied.

  • get(Class<out SomeInterface!>! defined in...

Am I incorrectly passing the class as a parameter?

Side Note: when I copy and paste the java code into a kotlin class in intellij it autoconverts it to:


but I get “unresolved reference: java”

Thank you.

pom contains:


#2 is correct. The “unresolved reference” error sounds like a dependency issue with the extension property defined in kotlin-runtime not being found. Perhaps the IntelliJ project is not set up correctly? In Maven, you should be getting kotlin-runtime through kotlin-stdlib.


On the Java platform, the runtime component required for using the reflection features is distributed as a separate JAR file (kotlin-reflect.jar). This is done to reduce the required size of the runtime library for applications that do not use reflection features. If you do use reflection, please make sure that the .jar file is added to the classpath of your project.


kotlin-reflect isn’t required for