(reflect) Concrete Type classes could define toString()

XMLWordPrintable

      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().

            Assignee:
            Joe Darcy
            Reporter:
            Eamonn McManus
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: