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

compiler fails to allow access to enclosing instance in super()

XMLWordPrintable

    • mantis
    • generic
    • solaris_8
    • Verified

      The following test case, fails to compile cleanly as it should. Perhaps this is
      due to the lookup finding the private one hiding the one from the enclosing scope.
      See also 4717593.

      /**
       * @test @(#)WhichImplicitThis6.java 1.1 02/07/19
       * @bug 4717633
       * @summary compiler fails to allow access to enclosing instance in super()
       *
       * @compile WhichImplicitThis6.java
       */

      class WhichImplicitThis6 {
          private int i;
          WhichImplicitThis6(int i) {}
          class Sub extends WhichImplicitThis6 {
              Sub() {
                  super(i); // i is not inherited, so it is the enclosing i
              }
          }
      }

            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: