Description:
StackOverFlowError while compiling the following code during instantiation of generic type. This bug is directly related to bug 6651719 except for the change in the code where upper bound of S is MyClass<T,S>. Even using other parameterized bounds like java.util.LinkedList<T> crashes. Not sure if fix for bug 6651719 would resolve this issue. Hence filing this as a separate CR.
<code>
class TestClass {
public void method1(MyClass<? extends MyClass<?, ?>, ? extends MyClass<?, ?>> m1) {
}
}
class MyClass<T extends S, S extends MyClass<T,S>> { // changing it to S extends java.util.List<T> crashes too
}
</code>
Compilation result is :
<output>
Following is the Error message:
The system is out of resources.
Consult the following stack trace for details.
java.lang.StackOverflowError
at com.sun.tools.javac.code.Types$23.visitClassType(Types.java:2593)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:568)
at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3240)
at com.sun.tools.javac.code.Types$23.visitWildcardType(Types.java:2616)
at com.sun.tools.javac.code.Types$23.visitWildcardType(Types.java:2593)
at com.sun.tools.javac.code.Type$WildcardType.accept(Type.java:430)
at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3240)
at com.sun.tools.javac.code.Types.hashCode(Types.java:2590)
at com.sun.tools.javac.code.Types$TypePair.hashCode(Types.java:2363)
at java.util.HashMap.put(HashMap.java:389)
at java.util.HashSet.add(HashSet.java:217)
at com.sun.tools.javac.code.Types$10.isCastableRecursive(Types.java:1103)
at com.sun.tools.javac.code.Types$10.visitWildcardType(Types.java:1144)
at com.sun.tools.javac.code.Types$10.visitWildcardType(Types.java:1090)
at com.sun.tools.javac.code.Type$WildcardType.accept(Type.java:430)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:3183)
at com.sun.tools.javac.code.Types.disjointType(Types.java:1087)
at com.sun.tools.javac.code.Types.disjointTypes(Types.java:1070)
at com.sun.tools.javac.code.Types$9.visitClassType(Types.java:979)
at com.sun.tools.javac.code.Types$9.visitClassType(Types.java:885)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:568)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:3183)
at com.sun.tools.javac.code.Types.isCastable(Types.java:881)
at com.sun.tools.javac.code.Types$9.visitWildcardType(Types.java:908)
at com.sun.tools.javac.code.Types$9.visitWildcardType(Types.java:885)
at com.sun.tools.javac.code.Type$WildcardType.accept(Type.java:430)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:3183)
at com.sun.tools.javac.code.Types.isCastable(Types.java:881)
at com.sun.tools.javac.code.Types.isCastable(Types.java:858)
at com.sun.tools.javac.code.Types$10.isCastableRecursive(Types.java:1105)
at com.sun.tools.javac.code.Types$10.visitWildcardType(Types.java:1144)
at com.sun.tools.javac.code.Types$10.visitWildcardType(Types.java:1090)
at com.sun.tools.javac.code.Type$WildcardType.accept(Type.java:430)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:3183)
at com.sun.tools.javac.code.Types.disjointType(Types.java:1087)
at com.sun.tools.javac.code.Types.disjointTypes(Types.java:1070)
at com.sun.tools.javac.code.Types$9.visitClassType(Types.java:979)
at com.sun.tools.javac.code.Types$9.visitClassType(Types.java:885)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:568)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:3183)
at com.sun.tools.javac.code.Types.isCastable(Types.java:881)
at com.sun.tools.javac.code.Types$9.visitWildcardType(Types.java:908)
at com.sun.tools.javac.code.Types$9.visitWildcardType(Types.java:885)
at com.sun.tools.javac.code.Type$WildcardType.accept(Type.java:430)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:3183)
at com.sun.tools.javac.code.Types.isCastable(Types.java:881)
at com.sun.tools.javac.code.Types.isCastable(Types.java:858)
at com.sun.tools.javac.code.Types$10.isCastableRecursive(Types.java:1105)
at com.sun.tools.javac.code.Types$10.visitWildcardType(Types.java:1144)
at com.sun.tools.javac.code.Types$10.visitWildcardType(Types.java:1090)
at com.sun.tools.javac.code.Type$WildcardType.accept(Type.java:430)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:3183)
at com.sun.tools.javac.code.Types.disjointType(Types.java:1087)
at com.sun.tools.javac.code.Types.disjointTypes(Types.java:1070)
at com.sun.tools.javac.code.Types$9.visitClassType(Types.java:979)
at com.sun.tools.javac.code.Types$9.visitClassType(Types.java:885)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:568)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:3183)
at com.sun.tools.javac.code.Types.isCastable(Types.java:881)
at com.sun.tools.javac.code.Types$9.visitWildcardType(Types.java:908)
at com.sun.tools.javac.code.Types$9.visitWildcardType(Types.java:885)
at com.sun.tools.javac.code.Type$WildcardType.accept(Type.java:430)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:3183)
at com.sun.tools.javac.code.Types.isCastable(Types.java:881)
at com.sun.tools.javac.code.Types.isCastable(Types.java:858)
at com.sun.tools.javac.code.Types$10.isCastableRecursive(Types.java:1105)
at com.sun.tools.javac.code.Types$10.visitWildcardType(Types.java:1144)
at com.sun.tools.javac.code.Types$10.visitWildcardType(Types.java:1090)
at com.sun.tools.javac.code.Type$WildcardType.accept(Type.java:430)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:3183)
at com.sun.tools.javac.code.Types.disjointType(Types.java:1087)
at com.sun.tools.javac.code.Types.disjointTypes(Types.java:1070)
at com.sun.tools.javac.code.Types$9.visitClassType(Types.java:979)
at com.sun.tools.javac.code.Types$9.visitClassType(Types.java:885)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:568)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:3183)
at com.sun.tools.javac.code.Types.isCastable(Types.java:881)
at com.sun.tools.javac.code.Types$9.visitWildcardType(Types.java:908)
at com.sun.tools.javac.code.Types$9.visitWildcardType(Types.java:885)
at com.sun.tools.javac.code.Type$WildcardType.accept(Type.java:430)
</output>
<version>
/net/sqindia/export/disk09/jdk/7/latest/binaries/solsparc/bin/java -version
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b24)
Java HotSpot(TM) Client VM (build 12.0-b01, mixed mode)
bash-3.00$ uname -a
SunOS hrajan 5.10 Generic sun4u sparc SUNW,Sun-Blade-100