vendredi 9 avril 2021

Class

In the past, you were able to use

Class<?> type = (Class<?>) ((ParameterizedType)this.getClass().getGenericSuperclass()).getActualTypeArguments()[0];

to get the type arguments of your class.

But now, in Java 15, it throws ClassCastException because getGenericSuperclass is not of type ParemeterizedType.





Aucun commentaire:

Enregistrer un commentaire