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

javac crashes with StackOverflowError

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 7
    • 6u1
    • tools
    • b39
    • generic
    • generic
    • Not verified

      I have a non-trivial source tree that crashes javac with the following stack trace:

      The system is out of resources.
      Consult the following stack trace for details.
      java.lang.StackOverflowError
              at com.sun.tools.javac.code.Type$WildcardType.accept(Type.java:415)
              at com.sun.tools.javac.code.Types$MapVisitor.visit(Types.java:3214)
              at com.sun.tools.javac.code.Types.upperBound(Types.java:95)
              at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2968)
              at com.sun.tools.javac.code.Types.adapt(Types.java:2998)
              at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2959)
              at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2968)
              at com.sun.tools.javac.code.Types.adapt(Types.java:2998)
              at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2959)
              at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2968)
              at com.sun.tools.javac.code.Types.adapt(Types.java:2998)
              at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2959)
              at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2968)
              at com.sun.tools.javac.code.Types.adapt(Types.java:2998)
              at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2959)
              at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2968)
              at com.sun.tools.javac.code.Types.adapt(Types.java:2998)
              at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2959)
              at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2968)
              at com.sun.tools.javac.code.Types.adapt(Types.java:2998)
              at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2959)
              at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2968)

      This happens with the following java versoin on Linux:

        : java -fullversion
        java full version "1.6.0_01-b06"

      If this can be fixed w/o a test case, that would be wonderful, but otherwise to produce a test case I need to identify which part of the source file is causing this problem. Is there anyway to run javac with some sort of debug flag so that I can figure out which source file is failing to compile? I think that is necessary for me to come up with a smaller test case.
      Here's a very small test case:

      class A<T extends A<?>> {}
      class B extends A<A<?>> {}

      class Test {
          A<A<?>> t = null;
          B c = (B)t;
      }

            mcimadamore Maurizio Cimadamore
            kkawagucsunw Kohsuke Kawaguchi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: