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

crash: java.lang.AssertionError at com.sun.tools.javac.code.Types.containedBy(Types.java:792)

    Details

    • Subcomponent:
    • Resolved In Build:
      b67
    • CPU:
      x86
    • OS:
      linux, windows_xp
    • Verification:
      Verified

      Description

      FULL PRODUCT VERSION :
      J2SE(TM) Development Kit 5.0 Update 1 (jdk 1.5.0.01)

      ADDITIONAL OS VERSION INFORMATION :
      Suse 9.2 professionnal (kernel 2.6.8)

      A DESCRIPTION OF THE PROBLEM :
      import java.util.*;

      public class Generic {

      public <K> TreeMap<K,K> essai(K type) {
      TreeMap<K,K> treeMap = new TreeMap<K,K>();
      return treeMap;
      }

      public static void main(String args[]) {
      Generic generic = new Generic();

      //et ci-dessous c'est le drame
      TreeMap<?,?> treeMap = generic.essai(null);

      }
      }

      ------------------------------------------------------------------------

      Try to compile the program above

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      import java.util.*;

      public class Generic {

      public <K> TreeMap<K,K> essai(K type) {
      TreeMap<K,K> treeMap = new TreeMap<K,K>();
      return treeMap;
      }

      public static void main(String args[]) {
      Generic generic = new Generic();

      //et ci-dessous c'est le drame
      TreeMap<?,?> treeMap = generic.essai(null);

      }
      }

      ------------------------------------------------------------------------

      Try to compile the program above

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I don't know, but the compiler said me it crashed and send you this report of bug
      ACTUAL -
      Compiler crashes

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      hibounds=java.lang.Object
      An exception has occurred in the compiler (1.5.0-rc). 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:792)
              at com.sun.tools.javac.code.Types$ContainsTypeFcn.visitArgumentType(Types.java:871)
              at com.sun.tools.javac.code.Type$ArgumentType.accept(Type.java:358)
              at com.sun.tools.javac.code.Types$ContainsTypeFcn.containsType(Types.java:851)
              at com.sun.tools.javac.code.Types.containsType(Types.java:841)
              at com.sun.tools.javac.code.Types.containsType(Types.java:811)
              at com.sun.tools.javac.code.Types$IsSubTypeFcn.visitClassType(Types.java:421)
              at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:473)
              at com.sun.tools.javac.code.Types$IsSubTypeFcn.isSubType(Types.java:344)
              at com.sun.tools.javac.code.Types.isSubType(Types.java:327)
              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:140)
              at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1110)
              at com.sun.tools.javac.tree.Tree$Apply.accept(Tree.java:819)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:256)
              at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:271)
              at com.sun.tools.javac.comp.Attr.visitVarDef(Attr.java:531)
              at com.sun.tools.javac.tree.Tree$VarDef.accept(Tree.java:511)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:256)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:291)
              at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:307)
              at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:561)
              at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:540)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:256)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:291)
              at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:494)
              at com.sun.tools.javac.tree.Tree$MethodDef.accept(Tree.java:482)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:256)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:291)
              at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2424)
              at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2357)
              at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2306)
              at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:410)
              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:58)
              at com.sun.tools.javac.Main.main(Main.java:48)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.*;

      public class Generic {

      public <K> TreeMap<K,K> essai(K type) {
      TreeMap<K,K> treeMap = new TreeMap<K,K>();
      return treeMap;
      }

      public static void main(String args[]) {
      Generic generic = new Generic();

      //et ci-dessous c'est le drame
      TreeMap<?,?> treeMap = generic.essai(null);

      }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      import java.util.*;

      public class Generic {

      public <K> TreeMap<K,K> essai(K type) {
      TreeMap<K,K> treeMap = new TreeMap<K,K>();
      return treeMap;
      }

      public static void main(String args[]) {
      Generic generic = new Generic();

      //use whatever but not wildcard type even if it doesn't mean the same
      TreeMap<Object,Object> treeMap = generic.essai(null);

      }
      }
      ###@###.### 2005-1-07 18:48:49 GMT

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ahe Peter Ahe
                Reporter:
                gmanwanisunw Girish Manwani (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: