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

Hiding of fields not fully supported

XMLWordPrintable

    • mantis
    • generic
    • solaris_8
    • Verified

      javac fails jacks 8.3-runtime-1, the sympton of which is exposed by the following test:

      /**
       * @test %W% %E%
       * @bug 4717593
       * @summary Hiding of fields not fully supported
       *
       * @compile WhichImplicitThis5.java
       * @run main WhichImplicitThis5
       */

      public class WhichImplicitThis5 {
          static int init;
          public int i = ++init;
          class One extends WhichImplicitThis5 {
              private Object i; // hide enclosing i
          }
          class Two extends One {
              // has no i member
              Two() {
                  WhichImplicitThis5.this.super();
              }
              int j = i; // i from enclosing scope
              int k = ((WhichImplicitThis5) this).i; // get hidden i
              Object l = super.i;
          }
          public static void main(String[] args) {
              Two t = new WhichImplicitThis5().new Two();
              if (t.j != 1 || t.k != 2 || t.l != null)
                  throw new Error();
          }
      }

            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: