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.
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.
- duplicates
-
JDK-6558545 Undecidable type system leads to stack overflow
- Open