Consider special case for Class.getSuperclass() result type

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Won't Fix
    • Priority: P5
    • None
    • Affects Version/s: 6
    • Component/s: tools
    • None
    • 5.0
    • 5.0
    • generic
    • generic

      The result type of getSuperclass is somewhat useless, consider this example:

      Integer i = 1;
      i.getClass().getSuperclass();

      The static type of the last is expression is (before capture conversion is applied):

      Class<? super X> where X extends Integer.

      This is equivalent to:

      Class<?>

      which means that all information is lost.

      The compiler knows that the restult type of i.getClass() is Class<? extends Integer> so the result type of i.getClass().getSuperclass() should be Class<? extends Number>.
      ###@###.### 10/29/04 23:54 GMT

            Assignee:
            Peter Ahe
            Reporter:
            Peter Ahe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: