mercredi 27 novembre 2019

Passing unknown enum type to constructor with vararg enum parameter

I have a method that I got through reflection that takes in a vararg itemFlags: ItemFlag parameter. I have the enum type, ItemFlag, which I also found through reflection. How do I go about invoking the method with a typed array of ItemFlag if the type is unknown? I've tried creating an Array<Any> with the enum instances and passing that as the argument but it throws IllegalArgumentException with a message of argument type mismatch.





Aucun commentaire:

Enregistrer un commentaire