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

javac doesn't detect cyclic constructor invocation

    XMLWordPrintable

Details

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

    Description



      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

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: