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

varargs: javac crashes during overload resolution with generic varargs

XMLWordPrintable

    • b128
    • unknown
    • generic
    • Verified

      The following program crashes javac:

      class B {
          public <X extends Number> void m(X... args) { }
          public void m(Object... args) { }

          { m(null, null); }
      }


      Here's the stack trace:

      An exception has occurred in the compiler (1.7.0-ea). 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.NullPointerException
              at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3624)
              at com.sun.tools.javac.code.Types$Subst.subst(Types.java:2171)
              at com.sun.tools.javac.code.Types.subst(Types.java:2145)
              at com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:401)
              at com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:378)
              at com.sun.tools.javac.comp.Resolve.instantiate(Resolve.java:405)
              at com.sun.tools.javac.comp.Resolve.signatureMoreSpecific(Resolve.java:811)
              at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:720)
              at com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:694)
              at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:914)
              at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:878)
              at com.sun.tools.javac.comp.Resolve.findFun(Resolve.java:962)
              at com.sun.tools.javac.comp.Resolve.resolveMethod(Resolve.java:1359)
              at com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:2105)
              at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:1704)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:436)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:423)
              at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:454)
              at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1434)
              at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1320)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:436)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:423)
              at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:465)
              at com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1207)
              at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1166)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:436)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:423)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:485)
              at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:501)
              at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:862)
              at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:780)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:436)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:423)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:485)
              at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:3137)
              at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:3063)
              at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2999)
              at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1157)
              at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:847)
              at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:806)
              at com.sun.tools.javac.main.Main.compile(Main.java:411)
              at com.sun.tools.javac.main.Main.compile(Main.java:329)
              at com.sun.tools.javac.main.Main.compile(Main.java:320)
              at com.sun.tools.javac.Main.compile(Main.java:76)
              at com.sun.tools.javac.Main.main(Main.java:61)

            mcimadamore Maurizio Cimadamore
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: