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

Object.getClass() should return erased class type

XMLWordPrintable

    • b48
    • generic
    • solaris_8

      See http://forum.java.sun.com/thread.jsp?forum=316&thread=496028

      The following program fragment fails to compile

          void f(List<Integer> li, List<String> ls) {
              if (li.getClass() == ls.getClass())
      ;
          }

      because the intersection of Class<List<Integer>> and Class<List<String>> is
      empty.

            sseligmasunw Scott Seligman (Inactive)
            gafter Neal Gafter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: