samedi 27 août 2022

GetActualTypeArguments returns TypeVariableImpl with only the symbol (T) as the class name

I've looked at the bytecode and I can see that within my class the type parameters have not been erased, I've tried the getActualParameters on generic superclass way as well as using TypeToken but both appear to simply return T/TypeVariableImpl which I don't believe can give me the actual class of the parameter.

This shouldn't be a duplicate as I've searched far and wide and cannot find an answer to this, and each one I've tried either presents me with Object or T, neither of which are of any use to me.

public class EventConsumer<T extends INonkbookEvent<INonkbookEventParameter>> extends EventListener<T>

Essentially I want to reflect the T param, having looked at the bytecode I can see this implementation is compiled: my compiled eventlistener class





Aucun commentaire:

Enregistrer un commentaire