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

generics problem: inner interface causes "not within bounds"

    • beta2
    • generic
    • solaris_7
    • Verified

      frog:~/workspaces/test/NotWithinBounds $ cat -n NotWithinBounds.java
           1 class Builder<Community> {
           2
           3 class Produces<B extends AbstractBuilder> {}
           4
           5 interface AbstractBuilder {}
           6
           7 }
           8
           9 class MyBuilder extends Builder<String> {
          10 // the next two lines both generate "not within bounds" errors
          11 Produces<HTMLConsumer> p0;
          12 Produces<MyABuilder> p1;
          13 }
          14
          15 class MyABuilder implements HTMLConsumer {
          16 }
          17
          18 interface HTMLConsumer extends Builder<String>.AbstractBuilder {}
          19
          20
          21
      frog:~/workspaces/test/NotWithinBounds $ newjavac NotWithinBounds.java
      NotWithinBounds.java:11: type parameter HTMLConsumer is not within its bound
          Produces<HTMLConsumer> p0;
                  ^
      NotWithinBounds.java:12: type parameter MyABuilder is not within its bound
          Produces<MyABuilder> p1;
                  ^
      2 errors
      frog:~/workspaces/test/NotWithinBounds $

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: