Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5026430

ParameterizedTypeImpl should override toString

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      The ParameterizedType implementation returned by getGenericParameterTypes does not override toString, so printing out one these beasts yields no useful information. The following program illustrates the problem:

      import java.util.*;
      import java.lang.reflect.*;

      public class Junk {
          public static void main(String[] args) throws Exception {
              System.out.println(Junk.class.getMethod("foo", List.class).
                                 getGenericParameterTypes()[0]);
          }

          public void foo(List<String> dogs) {}
      }

      Running this program prints:

      sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl@1a758cb

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              darcy Joe Darcy
              Reporter:
              jjb Josh Bloch
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: