vendredi 19 février 2016

Is it possible to somehow overcome type erasure in Java?

Here's the thing. We use a lot of Wicket Panels in our application, and for testing purposes they should ideally be generated generically. Part of this works, in theory: For every parameter type in a constructor I have only one possible argument to offer, so it is a matter of finding what these parameter types are - Reflection. Problem being: Type Erasure. Many of the constructors use multiple versions of the Model< > class as parameters with various different type parameters to it. Type Erasure means that as far as I can find I have no way to differentiate between these at runtime. So, in this situation, is there any way to overcome or circumvent type erasure?





Aucun commentaire:

Enregistrer un commentaire