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

javac crashes on code for new rule for semantics of ? without -source 1.5

XMLWordPrintable

    • b28
    • generic
    • generic

      compiler following code ( javac test.java ) , compiler crashes.

      class A{}
      class B{}

      public class test {

      void foo(){
        boolean b = false;
        Class a = b ? A.class : B.class;
        System.out.println("a is " + a.getName());
      }

      public static void main(String[] args)
      {
       new test().foo();
       }

      }
      java.lang.AssertionError
              at com.sun.tools.javac.code.Types.merge(Types.java:2519)
              at com.sun.tools.javac.code.Types.intersect(Types.java:2473)
              at com.sun.tools.javac.code.Types.lub(Types.java:2591)
              at com.sun.tools.javac.code.Types.lub(Types.java:2560)
              at com.sun.tools.javac.comp.Attr.condType1(Attr.java:828)
              at com.sun.tools.javac.comp.Attr.condType(Attr.java:762)
              at com.sun.tools.javac.comp.Attr.visitConditional(Attr.java:743)
              at com.sun.tools.javac.tree.Tree$Conditional.accept(Tree.java:696)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:258)
              at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:273)
              at com.sun.tools.javac.comp.Attr.visitVarDef(Attr.java:532)
              at com.sun.tools.javac.tree.Tree$VarDef.accept(Tree.java:502)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:258)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:293)
              at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:309)
              at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:562)
              at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:531)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:258)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:293)
              at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:499)
              at com.sun.tools.javac.tree.Tree$MethodDef.accept(Tree.java:473)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:258)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:293)
              at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2338)
              at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2217)
              at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2168)
              at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:412)
              at com.sun.tools.javac.main.Main.compile(Main.java:598)
              at com.sun.tools.javac.main.Main.compile(Main.java:546)
              at com.sun.tools.javac.Main.compile(Main.java:41)
              at com.sun.tools.javac.Main.main(Main.java:32)

            gafter Neal Gafter (Inactive)
            ssides Steve Sides
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: