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

javac doesn't detect cyclic constructor invocation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0, 1.3.0
    • tools
    • generic, sparc
    • generic, solaris_7



      Name: igT44549 Date: 02/10/99


      /*

      javac compiles the following illegal program:
      (The two Y constructors are mutually recursive.)

      */
      package test;
      public class X {
          public static void main(final String[] args) {
      new X ().new Y();
          }

          class Y {
      Y () {
      X.this.this(X.this);
      }

      Y (X x) {
      x.this();
      }
          }
      }
      (Review ID: 53621)
      ======================================================================

      It is hardly necessary to use such a complex example, e.g., using
      the qualified 'this()' notation. The following case also exhibits
      the bug:

          class Y {
      Y () {
      this(1);
      }

      Y (int x) {
      this();
      }
          }

      william.maddox@Eng 1999-02-12

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: