# Calling a Java function that takes a non-generic parameter of a generic type

**URL:** <https://discuss.kotlinlang.org/t/calling-a-java-function-that-takes-a-non-generic-parameter-of-a-generic-type/1412>\
**Category:** Support\
**Created:** [January 16, 2016, 5:04pm UTC](https://discuss.kotlinlang.org/t/calling-a-java-function-that-takes-a-non-generic-parameter-of-a-generic-type/1412 "2016-01-16T17:04:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CLX](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@CLX](https://discuss.kotlinlang.org/u/CLX)\
**Post date:** [January 16, 2016, 5:04pm UTC](https://discuss.kotlinlang.org/t/calling-a-java-function-that-takes-a-non-generic-parameter-of-a-generic-type/1412/1 "2016-01-16T17:04:02Z")

</div>

I honestly didn’t know how to word that title any shorter.  
Basically, the problem is that I have a library with a method of the following signature:  
`public void method(Class parameter) { throw new RuntimeException("Stub!"); }`  
and I can’t find a way to call it from Kotlin. If I try with a `::class.java` as parameter, I get the following error:  
`required: java.lang.Class! found: java.lang.Class<com.example.package.Test>`  
Trying `as java.lang.Class` didn’t help either.  
Is there anything specific I can do to call a method like that or is that not possible in Kotlin right now?

Thanks in advance for any help.

---

<div class="post-metadata">

**Author:** ![pniederw1](https://avatars.discourse-cdn.com/v4/letter/p/0ea827/32.png) [@pniederw1](https://discuss.kotlinlang.org/u/pniederw1)\
**Post date:** [January 17, 2016, 11:11am UTC](https://discuss.kotlinlang.org/t/calling-a-java-function-that-takes-a-non-generic-parameter-of-a-generic-type/1412/2 "2016-01-17T11:11:08Z")

</div>

`method(Foo::class.java)` works fine for me, with 1.0-beta-4.
