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

javac crashes when using MethodHandle invocation syntax on MethodHandle subclass

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Won't Fix
    • Affects Version/s: 7
    • Fix Version/s: 7
    • Component/s: tools
    • Subcomponent:
    • CPU:
      unknown
    • OS:
      generic

      Description

      John, I was playing around with JSR-292 and ran into this scenario (based on a sample.)


      import java.dyn.*;

      public class Test {
          static class Greeter extends JavaMethodHandle {
              private final String greetee;
              public void run() { System.out.println("hello, " + greetee); }
              
              Greeter(String greetee) {
                  super(RUN);
                  this.greetee = greetee;
              }

              private static final MethodHandle RUN = MethodHandles.lookup().findVirtual(Greeter.class, "run", MethodType.make(void.class));
          }
          
          public static void main(String[] args) {
              Greeter greeter = new Greeter("world");
             
              try {
                  greeter.<void>invoke(); // NOTE: subclass of methodHandle.
              } catch(Throwable e) {
                  System.out.println("Exception:" + e);
              }
          }
      }

      An exception has occurred in the compiler (1.7.0-internal). 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.comp.Attr.visitApply(Attr.java:1388)
      at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1304)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:395)
      at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:419)
      at com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1120)
      at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1150)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:395)
      at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:445)
      at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:461)
      at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:809)
      at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:773)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:395)
      at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:445)
      at com.sun.tools.javac.comp.Attr.visitTry(Attr.java:984)
      at com.sun.tools.javac.tree.JCTree$JCTry.accept(JCTree.java:1031)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:395)
      at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:445)
      at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:461)
      at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:809)
      at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:773)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:395)
      at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:445)
      at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:730)
      at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:660)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:395)
      at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:445)
      at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:3062)
      at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2985)
      at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2921)
      at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1122)
      at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:842)
      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:801)
      at com.sun.tools.javac.main.Main.compile(Main.java:409)
      at com.sun.tools.javac.main.Main.compile(Main.java:327)
      at com.sun.tools.javac.main.Main.compile(Main.java:318)
      at com.sun.tools.javac.Main.compile(Main.java:82)
      at com.sun.tools.javac.Main.main(Main.java:67)

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: