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

Consider special case for Class.getSuperclass() result type

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P5
    • Resolution: Won't Fix
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • Introduced In Build:
      5.0
    • Introduced In Version:
      5.0
    • CPU:
      generic
    • OS:
      generic

      Description

      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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: