test/tools/javac/meth/InvokeDyn.java

changeset 674
584365f256a7
parent 573
005bec70ca27
child 752
03177f49411d
     1.1 --- a/test/tools/javac/meth/InvokeDyn.java	Tue Sep 07 17:31:54 2010 +0100
     1.2 +++ b/test/tools/javac/meth/InvokeDyn.java	Tue Sep 07 17:32:27 2010 +0100
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -23,12 +23,12 @@
    1.11  
    1.12  /*
    1.13   * @test
    1.14 - * @bug 6754038
    1.15 + * @bug 6754038 6979327
    1.16   * @summary Generate call sites for method handle
    1.17   * @author jrose
    1.18   *
    1.19   * @library ..
    1.20 - * @compile -source 7 -target 7 InvokeDyn.java
    1.21 + * @compile -source 7 -target 7 -XDinvokedynamic -XDallowTransitionalJSR292=no InvokeDyn.java
    1.22   */
    1.23  //No: @run main/othervm -XX:+EnableInvokeDynamic meth.InvokeDyn
    1.24  
    1.25 @@ -44,16 +44,21 @@
    1.26  
    1.27  package meth;
    1.28  
    1.29 -import java.dyn.InvokeDynamic;
    1.30 +import java.dyn.*;
    1.31  
    1.32  public class InvokeDyn {
    1.33 +    class CS extends CallSite {
    1.34 +        CS(Object x, Object y, Object z) { throw new RuntimeException(); }
    1.35 +    }
    1.36 +    //@BootstrapMethod(CS.class)  //note: requires 6964498
    1.37      void test() throws Throwable {
    1.38          Object x = "hello";
    1.39 -        InvokeDynamic.greet(x, "world", 123);
    1.40 -        InvokeDynamic.greet(x, "mundus", 456);
    1.41 -        InvokeDynamic.greet(x, "kosmos", 789);
    1.42 -        InvokeDynamic.<String>cogitate(10.11121, 3.14);
    1.43 -        InvokeDynamic.<void>#"yow: what I mean to say is, please treat this one specially"(null);
    1.44 -        InvokeDynamic.<int>invoke("goodbye");
    1.45 +        Object ojunk; int ijunk;
    1.46 +        ojunk = InvokeDynamic.greet(x, "world", 123);
    1.47 +        ojunk = InvokeDynamic.greet(x, "mundus", 456);
    1.48 +        ojunk = InvokeDynamic.greet(x, "kosmos", 789);
    1.49 +        ojunk = (String) InvokeDynamic.cogitate(10.11121, 3.14);
    1.50 +        InvokeDynamic.#"yow: what I mean to say is, please treat this one specially"(null);
    1.51 +        ijunk = (int) InvokeDynamic.invoke("goodbye");
    1.52      }
    1.53  }

mercurial