Details
-
Enhancement
-
Resolution: Fixed
-
P4
-
5.0
-
b48
-
generic
-
generic
Description
The Type instances that you get back from e.g. Method.getGenericReturnType() could define useful toString() methods. At the moment you get the default string, such as "sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl@1e0be38". Existing reflection classes do define useful toString() methods, e.g. Method.toString() which may return "public abstract java.util.Set T.stringSet()". Having a useful toString() makes it much easier to produce meaningful exception messages in code that uses reflection ("Could not map " + parameterizedType + " to a factory").
Incidentally Method.toString() could then use getGenericReturnType() and getGenericParameterTypes() instead of getReturnType() and getParameterTypes().
Incidentally Method.toString() could then use getGenericReturnType() and getGenericParameterTypes() instead of getReturnType() and getParameterTypes().
Attachments
Issue Links
- duplicates
-
JDK-5026430 ParameterizedTypeImpl should override toString
- Closed
- relates to
-
JDK-6298888 Add toGenericString to j.l.Class and getTypeName to j.l.reflect.Type
- Closed