# Is it possible to call toTypedArray() with non-reified T, somehow passing in Class\<T\>?

**URL:** https://discuss.kotlinlang.org/t/is-it-possible-to-call-totypedarray-with-non-reified-t-somehow-passing-in-class-t/2504
**Category:** Uncategorized
**Created:** [April 18, 2017, 1:51pm UTC](https://discuss.kotlinlang.org/t/is-it-possible-to-call-totypedarray-with-non-reified-t-somehow-passing-in-class-t/2504 "2017-04-18T13:51:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Martin\_Vysny](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@Martin\_Vysny](https://discuss.kotlinlang.org/u/Martin_Vysny)
#### Post date: [April 18, 2017, 1:51pm UTC](https://discuss.kotlinlang.org/t/is-it-possible-to-call-totypedarray-with-non-reified-t-somehow-passing-in-class-t/2504/1 "2017-04-18T13:51:00Z")

</div>

Imagine the following code:

```auto
fun <T : Serializable> List<Reference<T>>.getValues(): Array<T?> = map { it.get() }.toTypedArray()

```

This naturally produces the “Cannot use ‘T’ as reified type parameter. Use a class instead” error message. Yet, since this method is to be called by Java stuff, it would be great if the `getValues()` method could take a parameter of type `Class<T>`. Is it possible?  
Thank you
