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

wrong enclosing instance for local class creation

    XMLWordPrintable

Details

    • mantis
    • generic
    • solaris_8
    • Verified

    Description

      javac fails the following test case

      // compiler selects wrong enclosing instance for local
      // class creation expression

      public class T3 {
          boolean isCorrect() { return true; }
          void check() {
              class I2 {
                  public void check() {
                      if (!isCorrect()) throw new Error();
                  }
              }
              class I3 extends T3 {
                  boolean isCorrect() { return false; }
                  public void check() {
                      new I2().check(); // which outer does I2 get?
                  }
              }
              new I3().check();
          }
          public static void main(String[] args) {
              new T3().check();
          }
      }

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: