Java Compiler crashes on my System
I work on SuSe linux 9.2 professional with the JDK1.5.0.01 (J2SE(TM) Development Kit 5.0 Update 1), the last release at this date.
When I attempt to compile the following code, the compiler crashes :
import java.util.TreeMap;
publicclass Generic{
public <K> TreeMap<K,K> f(K type){
returnnew TreeMap<K,K>();
}
publicstaticvoid main(String args[]){
Generic g =new Generic();
//et ci-dessous c'est le drame
TreeMap<?,?> t = g.f(null);
}
}
More precisely, it crashes at the following instruction:
TreeMap<?,?> t = g.f(null);
But if I write the following instruction instead of the above one
TreeMap<String,String> t = g.f(null);
The compiler works without any problems.
I'd like to know if at your home it does the same or not. I'd like to know why it crashes and it is the only one problem I encountered with jdk1.5.0 compiler, it is strange.
Thanks
[1642 byte] By [
kroaxa] at [2007-10-1 3:03:34]

On Win2K it chokes on this source too.
C:\source\java\misc\5test>java15 -version
C:\source\java\misc\5test>C:\langs\java\jdk1.5.0_01\bin\java -version
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)
C:\source\java\misc\5test>C:\langs\java\jdk1.5.0_01\bin\javac Generic.java
An exception has occurred in the compiler (1.5.0_01). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.AssertionError: ?
at com.sun.tools.javac.code.Types.containedBy(Types.java:795)
at com.sun.tools.javac.code.Types$ContainsTypeFcn.visitArgumentType(Types.java:873)
at com.sun.tools.javac.code.Type$ArgumentType.accept(Type.java:358)
at com.sun.tools.javac.code.Types$ContainsTypeFcn.containsType(Types.java:853)
at com.sun.tools.javac.code.Types.containsType(Types.java:843)
at com.sun.tools.javac.code.Types.containsType(Types.java:813)
at com.sun.tools.javac.code.Types$IsSubTypeFcn.visitClassType(Types.java:424)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:473)
at com.sun.tools.javac.code.Types$IsSubTypeFcn.isSubType(Types.java:347)
at com.sun.tools.javac.code.Types.isSubType(Types.java:325)
at com.sun.tools.javac.code.Types.isSubType(Types.java:328)
at com.sun.tools.javac.comp.Infer.instantiateExpr(Infer.java:237)
at com.sun.tools.javac.comp.Check.instantiatePoly(Check.java:354)
at com.sun.tools.javac.comp.Check.checkType(Check.java:322)
at com.sun.tools.javac.comp.Attr.check(Attr.java:151)
at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1151)
at com.sun.tools.javac.tree.Tree$Apply.accept(Tree.java:819)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:280)
at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:295)
at com.sun.tools.javac.comp.Attr.visitVarDef(Attr.java:569)
at com.sun.tools.javac.tree.Tree$VarDef.accept(Tree.java:511)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:280)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:315)
at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:331)
at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:599)
at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:540)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:280)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:315)
at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:532)
at com.sun.tools.javac.tree.Tree$MethodDef.accept(Tree.java:482)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:280)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:315)
at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2473)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2406)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2355)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:444)
at com.sun.tools.javac.main.Main.compile(Main.java:592)
at com.sun.tools.javac.main.Main.compile(Main.java:544)
at com.sun.tools.javac.Main.compile(Main.java:67)
at com.sun.tools.javac.Main.main(Main.java:52)