changeset 41:82062030d68e

meth: convert tests for 6979327
author jrose
date Fri, 24 Sep 2010 14:32:17 -0700
parents 6552594edb94
children bd8323fd8671
files netbeans/meth/test/jdk/java/dyn/JUnitAssert.java netbeans/meth/test/jdk/java/dyn/MethodHandleBytecodeTest.java netbeans/meth/test/jdk/java/dyn/MethodHandleDemo.java netbeans/meth/test/jdk/java/dyn/MethodHandleSyntax.java netbeans/meth/test/jdk/java/dyn/MethodTypeTest.java
diffstat 5 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/netbeans/meth/test/jdk/java/dyn/JUnitAssert.java	Fri Sep 24 14:27:37 2010 -0700
+++ b/netbeans/meth/test/jdk/java/dyn/JUnitAssert.java	Fri Sep 24 14:32:17 2010 -0700
@@ -23,7 +23,7 @@
  * have any questions.
  */
 
-package jdk.java.dyn;
+package test.java.dyn;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
--- a/netbeans/meth/test/jdk/java/dyn/MethodHandleBytecodeTest.java	Fri Sep 24 14:27:37 2010 -0700
+++ b/netbeans/meth/test/jdk/java/dyn/MethodHandleBytecodeTest.java	Fri Sep 24 14:32:17 2010 -0700
@@ -23,7 +23,7 @@
  * have any questions.
  */
 
-package jdk.java.dyn;
+package test.java.dyn;
 
 import java.dyn.*;
 import java.dyn.MethodHandles.Lookup;
@@ -69,7 +69,7 @@
 
     private String invokeToString(MethodHandle mh, Object obj) throws Throwable {
         System.out.println("invoke mh="+mh);
-        return (String) mh.invokeGeneric(obj);
+        return (String) mh.<String>invokeGeneric(obj);
     }
 
     // Extra entry point for standalone use.  Use as follows:
--- a/netbeans/meth/test/jdk/java/dyn/MethodHandleDemo.java	Fri Sep 24 14:27:37 2010 -0700
+++ b/netbeans/meth/test/jdk/java/dyn/MethodHandleDemo.java	Fri Sep 24 14:32:17 2010 -0700
@@ -23,14 +23,14 @@
  * have any questions.
  */
 
-package jdk.java.dyn;
+package test.java.dyn;
 
 import java.dyn.*;
 import java.dyn.MethodHandles.Lookup;
 
 import org.junit.*;
 //import static org.junit.Assert.*;
-import static jdk.java.dyn.JUnitAssert.*;
+import static test.java.dyn.JUnitAssert.*;
 
 public class MethodHandleDemo {
     static String options = "";
@@ -76,48 +76,48 @@
         mh = lookup.findVirtual(Object.class,
                 "toString", MethodType.methodType(String.class));
         println("calling "+mh);
-        result = mh.<String>invoke((Object)"foo");
+        result = (String) mh.<String>invokeExact((Object)"foo");
         assertSame("foo", result);
 
         mh = lookup.findStatic(MethodHandleDemo.class,
                 "test0", MethodType.methodType(String.class));
         println("calling "+mh);
-        result = mh.<String>invoke();
+        result = (String) mh.<String>invokeExact();
         assertEquals("[test0]", result);
 
         mh = lookup.findStatic(MethodHandleDemo.class,
                 "test1", MethodType.methodType(String.class, String.class));
         println("calling "+mh);
-        result = mh.<String>invoke("X");
+        result = (String) mh.<String>invokeExact("X");
         assertEquals("[test1 X]", result);
         
         mh = MethodHandles.insertArguments(mh, 0, "Bounderby");
         println("calling bound "+mh);
-        result = mh.<String>invoke();
+        result = (String) mh.<String>invokeExact();
         assertEquals("[test1 Bounderby]", result);
 
         mh = lookup.findStatic(MethodHandleDemo.class,
                 "test2", MethodType.methodType(String.class, String.class, int.class));
         println("calling "+mh);
-        result = mh.<String>invoke("X", 123);
+        result = (String) mh.<String>invokeExact("X", 123);
         assertEquals("[test2 X #123]", result);
 
         mh = MethodHandles.insertArguments(mh, 0, "Buster");
         println("calling bound "+mh);
-        result = mh.<String>invoke(456);
+        result = (String) mh.<String>invokeExact(456);
         assertEquals("[test2 Buster #456]", result);
 
         Obj obj = new Obj("X");
         mh = lookup.findVirtual(I.class,
                 "test1", MethodType.methodType(String.class));
         println("calling "+mh);
-        result = mh.<String>invoke((I)obj);
+        result = (String) mh.<String>invokeExact((I)obj);
         assertEquals("[Obj.test1 X]", result);
 
         mh = lookup.findVirtual(I.class,
                 "test2", MethodType.methodType(String.class, int.class));
         println("calling "+mh);
-        result = mh.<String>invoke((I)obj, 123);
+        result = (String) mh.<String>invokeExact((I)obj, 123);
         assertEquals("[Obj.test2 X #123]", result);
     }
 
--- a/netbeans/meth/test/jdk/java/dyn/MethodHandleSyntax.java	Fri Sep 24 14:27:37 2010 -0700
+++ b/netbeans/meth/test/jdk/java/dyn/MethodHandleSyntax.java	Fri Sep 24 14:32:17 2010 -0700
@@ -23,7 +23,7 @@
  * have any questions.
  */
 
-package jdk.java.dyn;
+package test.java.dyn;
 
 import java.dyn.*;
 
@@ -41,7 +41,7 @@
         // The line will also display a red badge of error highlighting
         // in NetBeans, until we figure out how to patch NetBeans to allow
         // the polymorphic MH.invoke sites (and Dynamic.* ones too).
-        String result = mh.<String>invoke("foo");
+        String result = (String) mh.<String>invokeExact("foo");
         // Use this in ./nbproject/project.properties:
         // project.langtools=../langtools
         // reference.langtools-javac.jar=${project.langtools}/dist/bootstrap/lib/javac.jar
--- a/netbeans/meth/test/jdk/java/dyn/MethodTypeTest.java	Fri Sep 24 14:27:37 2010 -0700
+++ b/netbeans/meth/test/jdk/java/dyn/MethodTypeTest.java	Fri Sep 24 14:32:17 2010 -0700
@@ -23,7 +23,7 @@
  * have any questions.
  */
 
-package jdk.java.dyn;
+package test.java.dyn;
 
 import sun.dyn.MemberName;
 import java.dyn.MethodType;