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

class recursively extending itself causes compiler's StackOverflowError crash

XMLWordPrintable

    • 1.2beta2
    • x86, sparc
    • solaris_2.5, solaris_2.5.1, solaris_2.6, windows_95, windows_nt
    • Verified



      Name: laC46010 Date: 12/09/96


      The test case below causes compiler stack overflow and crash.

      See also similar bug that was fixed long ago:
      #1228407 (synopsis: fp.bugs 2439: recursive class definition causes compiler to go into loop)

      -------------------------clss04901.java----------------------------------
      // Ident: %Z%%M% %I% %E%
      // Copyright %G% Sun Microsystems, Inc. All Rights Reserved

      package javasoft.sqe.tests.lang.clss049.clss04901;
      import java.io.PrintStream;

      public class clss04901 extends clss04901 { // compile-time error
        public static void main(String argv[])
        {
           System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
        }
        public static int run(String argv[], PrintStream out) {
              clss04901 x;
              return 0/*STATUS_PASS*/;
        }
      }

      ------------------------------------------------------------------

      /export/ld32/jdk_1.1/bin/javac -d /export/ld12/java/leo/res/clss/classes tests/lang/CLSS/clss049/clss04903/clss04903.java
      java.lang.StackOverflowError
      at sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java)
      at sun.tools.java.ClassDefinition.getInnerClass(ClassDefinition.java)
      at sun.tools.java.ClassDefinition.getInnerClass(ClassDefinition.java)
      ....
      at sun.tools.java.ClassDefinition.getInnerClass(ClassDefinition.java)
      at sun.tools.java.ClassDefinition.resolveName(ClassDefinition.java)
      at sun.tools.java.Environment.resolveNames(Environment.java)
      at sun.tools.java.Environment.resolveNames(Environment.java)
      at sun.tools.java.Environment.resolveNames(Environment.java)
      at sun.tools.javac.SourceField.resolveTypeStructure(SourceField.java)
      at sun.tools.javac.SourceClass.resolveTypeStructure(SourceClass.java)
      at sun.tools.javac.SourceClass.basicCheck(SourceClass.java)
      at sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java)
      at sun.tools.javac.Main.compile(Main.java)
      at sun.tools.javac.Main.main(Main.java)
      error: An error has occurred in the compiler; please file a bug report (###@###.###).
      1 error
      ======================================================================

            wmaddoxsunw William Maddox (Inactive)
            leosunw Leo Leo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: