Posted by aviadbd
on December 17, 2005 at 9:56 PM PST
Anyone thought of adding the ability to discover which generics types are currently effective on a certain class?
Meaning: I have a field defined as:
Reflecting it's type would reveal only the type parameters (using getTypeParameters) which would be named "E" with no bounds. There is no way to get "Integer" with the current reflection ability - Even though the JRE could keep that information when a generic class is instantiated.
Two options I can see on doing that:
* Saving the info for each instance. Adds some info to a class, indeed.
* Creating a different Class for each type parameters set (like what's being done with arrays of different compound types and dimensions?). Might slow down reflection even more, but that's what reflection's all about.. :)