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

javac gets a stack overflow on generics code

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • 8
    • 7
    • tools
    • None
    • generic
    • windows_xp

      interface Pong<T> {}
      class Ping<T> implements Pong<Pong<? super Ping<Ping<T>>>> {
          static void Ping() {
              Pong<? super Ping<Long>> xxx;
              new Ping<Long>();

              xxx = new Ping<Long>(); // this line causes the overflow
          }
      }
      Compiling the above with jdk 8 fails with this:
      java.lang.StackOverflowError
      at com.sun.tools.javac.code.Types$26.visitType(Types.java:3038)
      at com.sun.tools.javac.code.Types$26.visitType(Types.java:3035)
      at com.sun.tools.javac.code.Type.accept(Type.java:114)
      at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3811)
      at com.sun.tools.javac.code.Types$26.visitClassType(Types.java:3043)
      at com.sun.tools.javac.code.Types$26.visitClassType(Types.java:3035)
      at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
      at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3811)
      at com.sun.tools.javac.code.Types$26.visitClassType(Types.java:3048)
      at com.sun.tools.javac.code.Types$26.visitClassType(Types.java:3035)
      at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
      at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3811)
      at com.sun.tools.javac.code.Types$26.visitClassType(Types.java:3048)
      at com.sun.tools.javac.code.Types$26.visitClassType(Types.java:3035)
      at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
                :
                :

      This also occurs with jdk 6 and jdk 7.

            Unassigned Unassigned
            jjh James Holmlund (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: