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

javac fails with StackOverflowException

XMLWordPrintable

    • b19
    • x86_64
    • linux
    • Verified

        FULL PRODUCT VERSION :
        java version "1.8.0_20-ea"
        Java(TM) SE Runtime Environment (build 1.8.0_20-ea-b14)
        Java HotSpot(TM) 64-Bit Server VM (build 25.20-b14, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Linux HOST 3.11.0-18-generic #32-Ubuntu SMP Tue Feb 18 21:11:14 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

        A DESCRIPTION OF THE PROBLEM :
        The class provided below compiles using javac 1.8.0_05-b13, but causes a stack overflow exception with javac 1.8.0_20-ea-b14.

        REGRESSION. Last worked in version 8

        ADDITIONAL REGRESSION INFORMATION:
        java version "1.8.0_05"
        Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
        Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Compile the source code given below.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        It should compile without problem.
        ACTUAL -
        It produces a stack overflow exception shown below.

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        The system is out of resources.
        Consult the following stack trace for details.
        java.lang.StackOverflowError
        at com.sun.tools.javac.code.Type.hasTag(Type.java:97)
        at com.sun.tools.javac.code.Types$SameTypeVisitor.visitType(Types.java:1102)
        at com.sun.tools.javac.code.Types$SameTypeVisitor.visitType(Types.java:1088)
        at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visitTypeVar(Types.java:4404)
        at com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:1266)
        at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4398)
        at com.sun.tools.javac.code.Types.isSameType(Types.java:1082)
        at com.sun.tools.javac.code.Types.isSameType(Types.java:1077)
        at com.sun.tools.javac.code.Types.containsTypeEquivalent(Types.java:4061)
        at com.sun.tools.javac.code.Types.containsTypeEquivalent(Types.java:1436)
        at com.sun.tools.javac.code.Types$LooseSameTypeVisitor.containsTypes(Types.java:1231)
        at com.sun.tools.javac.code.Types$SameTypeVisitor.visitClassType(Types.java:1156)
        at com.sun.tools.javac.code.Types$SameTypeVisitor.visitClassType(Types.java:1088)
        at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:763)
        at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4398)
        ...


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        public class StackOverflowBug {

          interface A<T> {
          }

          <T extends A<T>> T m(T v) {
            return m(v);
          }
        }
        ---------- END SOURCE ----------

              mcimadamore Maurizio Cimadamore
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: