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

REGRESSION: StackOverFlowError with Cyclic Class level Type Parameters when used in constructors

XMLWordPrintable

    • b29
    • generic
    • generic
    • Not verified

      Description:
      Compiler crashes with StackOverFlowError for the following code. This is a *REGRESSION*. Compiler throws "cyclic inheritance involving S" in JDK 7 b24 error as it should be, but goes into infinite loop with PIT b26. Strangely, if i comment the second constructor it compiles fine.

      <code>
      bash-3.00$ cat CyclicTypeParameters.java
      class CyclicTypeParameters<S extends T, T extends S>{
              CyclicTypeParameters(S s){
              }
              CyclicTypeParameters(){// Works fine on commenting this
              }
      }
      </code>
      Compilation result is :
      <output>
      The system is out of resources.
      Consult the following stack trace for details.
      java.lang.StackOverflowError
              at com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:952)
              at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3240)
              at com.sun.tools.javac.code.Types.erasure(Types.java:1502)
              at com.sun.tools.javac.code.Types$16.visitTypeVar(Types.java:1525)
              at com.sun.tools.javac.code.Types$16.visitTypeVar(Types.java:1505)
              at com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:952)
              at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3240)
              at com.sun.tools.javac.code.Types.erasure(Types.java:1502)
              at com.sun.tools.javac.code.Types$16.visitTypeVar(Types.java:1525)
              at com.sun.tools.javac.code.Types$16.visitTypeVar(Types.java:1505)
              at com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:952)
              at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3240)
              at com.sun.tools.javac.code.Types.erasure(Types.java:1502)
              at com.sun.tools.javac.code.Types$16.visitTypeVar(Types.java:1525)
              at com.sun.tools.javac.code.Types$16.visitTypeVar(Types.java:1505)
              at com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:952)
              at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3240)
              at com.sun.tools.javac.code.Types.erasure(Types.java:1502)
      </output>
      <version>
      bash-3.2$ /net/bonsai.sfbay/w/builds/jdk/7/pit/b26/solaris-i586/jdk1.7.0/bin/java -version
      java version "1.7.0-internal"
      Java(TM) SE Runtime Environment (build 1.7.0-internal-jprtadm_18_Mar_2008_12_26-b00)
      Java HotSpot(TM) Server VM (build 12.0-b01, mixed mode)
      </version>
      bash-3.2$ uname -a
      SunOS bonsai 5.11 snv_77 i86pc i386 i86pc

            mcimadamore Maurizio Cimadamore
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: