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

Compiler crashes with AssertionError: Missing type variable in where clause E

    Details

    • Subcomponent:
    • OS:
      os_x

      Description

      FULL PRODUCT VERSION :
      $ java -version
      java version "1.7.0_45"
      Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
      Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
      $ javac -version
      javac 1.7.0_45


      ADDITIONAL OS VERSION INFORMATION :
      Darwin foobar 12.5.0 Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64


      A DESCRIPTION OF THE PROBLEM :
      javac crashes with this assertion failure:

      An exception has occurred in the compiler (1.7.0_45). 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: Missing type variable in where clause E
      at com.sun.tools.javac.util.RichDiagnosticFormatter.unique(RichDiagnosticFormatter.java:234)
      at com.sun.tools.javac.util.RichDiagnosticFormatter.access$100(RichDiagnosticFormatter.java:67)
      at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitTypeVar(RichDiagnosticFormatter.java:384)
      at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitTypeVar(RichDiagnosticFormatter.java:326)
      at com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:1030)
      at com.sun.tools.javac.code.Printer.visit(Printer.java:131)
      at com.sun.tools.javac.code.Printer.visitTypes(Printer.java:103)
      at com.sun.tools.javac.code.Printer.visitClassType(Printer.java:194)
      at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitClassType(RichDiagnosticFormatter.java:366)
      at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitClassType(RichDiagnosticFormatter.java:326)
      at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
      at com.sun.tools.javac.code.Printer.visit(Printer.java:131)
      at com.sun.tools.javac.code.Printer.className(Printer.java:265)
      at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.className(RichDiagnosticFormatter.java:374)
      at com.sun.tools.javac.code.Printer.visitClassType(Printer.java:190)
      at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitClassType(RichDiagnosticFormatter.java:366)
      at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitClassType(RichDiagnosticFormatter.java:326)
      at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
      at com.sun.tools.javac.code.Printer.visit(Printer.java:131)
      at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument(AbstractDiagnosticFormatter.java:187)
      at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatIterable(AbstractDiagnosticFormatter.java:216)
      at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument(AbstractDiagnosticFormatter.java:184)
      at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArguments(AbstractDiagnosticFormatter.java:158)
      at com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:111)
      at com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMeta(BasicDiagnosticFormatter.java:184)
      at com.sun.tools.javac.util.BasicDiagnosticFormatter.formatDiagnostic(BasicDiagnosticFormatter.java:100)
      at com.sun.tools.javac.util.AbstractDiagnosticFormatter.format(AbstractDiagnosticFormatter.java:114)
      at com.sun.tools.javac.util.RichDiagnosticFormatter.format(RichDiagnosticFormatter.java:112)
      at com.sun.tools.javac.util.RichDiagnosticFormatter.format(RichDiagnosticFormatter.java:67)
      at com.sun.tools.javac.util.Log.writeDiagnostic(Log.java:434)
      at com.sun.tools.javac.util.Log.report(Log.java:416)
      at com.sun.tools.javac.comp.Resolve.logResolveError(Resolve.java:1828)
      at com.sun.tools.javac.comp.Resolve.access(Resolve.java:1296)
      at com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:1481)
      at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:2398)
      at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:2283)
      at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1677)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
      at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:449)
      at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1521)
      at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1321)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
      at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:460)
      at com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1294)
      at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1167)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
      at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:480)
      at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:496)
      at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:918)
      at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:781)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
      at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:480)
      at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:836)
      at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:669)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
      at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:480)
      at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:3250)
      at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:3173)
      at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:3109)
      at com.sun.tools.javac.comp.Attr.attrib(Attr.java:3083)
      at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1184)
      at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:870)
      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:829)
      at com.sun.tools.javac.main.Main.compile(Main.java:439)
      at com.sun.tools.javac.main.Main.compile(Main.java:353)
      at com.sun.tools.javac.main.Main.compile(Main.java:342)
      at com.sun.tools.javac.main.Main.compile(Main.java:333)
      at com.sun.tools.javac.Main.compile(Main.java:76)
      at com.sun.tools.javac.Main.main(Main.java:61)


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Get Google Guava 15.0 JAR.

      Then compile this program:

        $ javac -cp guava-15.0.jar bug.java

      import com.google.common.reflect.*;
      public class bug {
          <E> void foo() {
              new TypeResolver().where(new TypeParameter<E>(){}, null);
          }
      }


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      success, or at least a normal compiler error
      ACTUAL -
      assertion failure

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      An exception has occurred in the compiler (1.7.0_45). 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: Missing type variable in where clause E
      at com.sun.tools.javac.util.RichDiagnosticFormatter.unique(RichDiagnosticFormatter.java:234)
      at com.sun.tools.javac.util.RichDiagnosticFormatter.access$100(RichDiagnosticFormatter.java:67)
      at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitTypeVar(RichDiagnosticFormatter.java:384)
      at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitTypeVar(RichDiagnosticFormatter.java:326)
      at com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:1030)
      at com.sun.tools.javac.code.Printer.visit(Printer.java:131)
      at com.sun.tools.javac.code.Printer.visitTypes(Printer.java:103)
      at com.sun.tools.javac.code.Printer.visitClassType(Printer.java:194)
      at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitClassType(RichDiagnosticFormatter.java:366)
      at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitClassType(RichDiagnosticFormatter.java:326)
      at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
      at com.sun.tools.javac.code.Printer.visit(Printer.java:131)
      at com.sun.tools.javac.code.Printer.className(Printer.java:265)
      at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.className(RichDiagnosticFormatter.java:374)
      at com.sun.tools.javac.code.Printer.visitClassType(Printer.java:190)
      at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitClassType(RichDiagnosticFormatter.java:366)
      at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitClassType(RichDiagnosticFormatter.java:326)
      at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
      at com.sun.tools.javac.code.Printer.visit(Printer.java:131)
      at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument(AbstractDiagnosticFormatter.java:187)
      at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatIterable(AbstractDiagnosticFormatter.java:216)
      at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument(AbstractDiagnosticFormatter.java:184)
      at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArguments(AbstractDiagnosticFormatter.java:158)
      at com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:111)
      at com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMeta(BasicDiagnosticFormatter.java:184)
      at com.sun.tools.javac.util.BasicDiagnosticFormatter.formatDiagnostic(BasicDiagnosticFormatter.java:100)
      at com.sun.tools.javac.util.AbstractDiagnosticFormatter.format(AbstractDiagnosticFormatter.java:114)
      at com.sun.tools.javac.util.RichDiagnosticFormatter.format(RichDiagnosticFormatter.java:112)
      at com.sun.tools.javac.util.RichDiagnosticFormatter.format(RichDiagnosticFormatter.java:67)
      at com.sun.tools.javac.util.Log.writeDiagnostic(Log.java:434)
      at com.sun.tools.javac.util.Log.report(Log.java:416)
      at com.sun.tools.javac.comp.Resolve.logResolveError(Resolve.java:1828)
      at com.sun.tools.javac.comp.Resolve.access(Resolve.java:1296)
      at com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:1481)
      at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:2398)
      at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:2283)
      at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1677)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
      at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:449)
      at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1521)
      at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1321)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
      at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:460)
      at com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1294)
      at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1167)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
      at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:480)
      at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:496)
      at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:918)
      at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:781)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
      at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:480)
      at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:836)
      at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:669)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
      at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:480)
      at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:3250)
      at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:3173)
      at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:3109)
      at com.sun.tools.javac.comp.Attr.attrib(Attr.java:3083)
      at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1184)
      at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:870)
      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:829)
      at com.sun.tools.javac.main.Main.compile(Main.java:439)
      at com.sun.tools.javac.main.Main.compile(Main.java:353)
      at com.sun.tools.javac.main.Main.compile(Main.java:342)
      at com.sun.tools.javac.main.Main.compile(Main.java:333)
      at com.sun.tools.javac.Main.compile(Main.java:76)
      at com.sun.tools.javac.Main.main(Main.java:61)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------

      import com.google.common.reflect.*;
      public class bug {
          <E> void foo() {
              new TypeResolver().where(new TypeParameter<E>(){}, null);
          }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      Unknown

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dlsmith Dan Smith
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: