How to call enumValues of unknown enum e: KClass<Enum>


I have variable unknownEnumClass: KClass<Enum<*>>. How I can get their values?
I can not use kotlin.enumValues() function, because it has reified parameter.
In other words, I want to get a normal analog:

fun unknownEnumValues(unknownEnumClass: KClass<Enum<*>>): Array<Enum<*>> {
    return"values").invoke(null) as Array<Enum<*>>


Maybe this is what you are looking for?

import kotlin.reflect.KClass

fun main(args: Array<String>) {
    getEnumValues(Vowel::class).forEach { print("$it ") }
    println("Roman Numerals")
    getEnumValues(RomanNumerals::class).forEach { print("$it ") }

fun getEnumValues(enumClass: KClass<out Enum<*>>): Array<out Enum<*>> =

enum class Vowel { A, E, I, O, U }
enum class RomanNumerals { I, V, X, L, C, D, M }


Thank you.