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

Bound error on wildcard code

    XMLWordPrintable

Details

    • b32
    • 7
    • b40
    • generic
    • generic
    • Not verified

    Description

      This somewhat confusing code result in a bound error. It passed as of recent builds.
      ------FBoundedColorPoint.java-----------------
      public class FBoundedColorPoint
      {

      class AbstractPoint<T extends AbstractPoint<T>> {
              int x, y;
              boolean equals(T that) { return (this.x == that.x) && (this.y == that.y); }
      }

      class Point extends AbstractPoint<Point> { }

          public FBoundedColorPoint() {
                      AbstractPoint<? super Point> con; // <<pass>>
          }
      }
      ---------------
      This test case I though was in the regression test set, so maybe it was removed(?) and so I gave it rather low priority. The error message is:

      FBoundedColorPoint.java:12: type parameter capture#716 of ? super FBoundedColorPoint.Point is not within its bound
                      AbstractPoint<? super Point> con; // <<pass>>
                                            ^
      1 error

      Attachments

        Issue Links

          Activity

            People

              mcimadamore Maurizio Cimadamore
              ssides Steve Sides
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: