changeset 6:32ab4e7c9d80

meth: netbeans project w/ unit tests
author jrose
date Fri, 08 May 2009 14:24:28 -0700
parents 41bc9c25b6d0
children 4176fc455aa1
files netbeans/meth/README.txt netbeans/meth/TEST.sh netbeans/meth/build.xml netbeans/meth/nbproject/project.properties netbeans/meth/nbproject/project.xml netbeans/meth/test/jdk/java/dyn/HelloDynamic.java netbeans/meth/test/jdk/java/dyn/InvokeDynamicDemo.java 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/MethodHandlesTest.java netbeans/meth/test/jdk/java/dyn/MethodTypeTest.java netbeans/meth/test/jdk/java/dyn/util/WrapperTest.java netbeans/meth/test/sun/dyn/util/ValueConversionsTest.java
diffstat 15 files changed, 2606 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netbeans/meth/README.txt	Fri May 08 14:24:28 2009 -0700
@@ -0,0 +1,142 @@
+Standalone NetBeans project of JSR 292 RI
+
+Plea for Help:  The project.properties file is known to work on John's macbook, but not elsewhere.  Please help tidy and port it!
+
+To open:
+  open '/Applications/NetBeans/NetBeans 6.5.app'
+  Open Project => select .../davinci/patches/netbeans/meth
+
+To build:
+  cd .../davinci/patches/netbeans/meth; ant clean test
+
+To run a unit test (requires modified JVM):
+  #NetBeansResources="/Applications/NetBeans/NetBeans 6.5.app/Contents/Resources"
+  #junit="$NetBeansResources/NetBeans/platform9/modules/ext/junit-4.5.jar"
+  export junit=$HOME/env/jars/junit-4.1.jar  #(or wherever you have it stashed)
+  export mhproj="$HOME/Projects/meth"  #(pwd -P)
+  export cpath="$mhproj/build/classes:$mhproj/build/test/classes:$junit"
+  export java7=$JAVA7X_HOME/bin/java
+  $java7 -XX:+EnableMethodHandles -Xbootclasspath/p:"$cpath" jdk.java.dyn.MethodHandleBytecodeTest
+
+Simpler MH demo:
+  $java7 -XX:+EnableMethodHandles -Xbootclasspath/p:"$cpath" jdk.java.dyn.MethodHandleDemo
+
+Using JUnit 4:
+  $java7 -XX:+EnableMethodHandles -Xbootclasspath/p:"$cpath" org.junit.runner.JUnitCore jdk.java.dyn.MethodHandlesTest
+
+N.B.:  For changes not yet merged with the JDK, be sure to use use -Xbootclasspath.
+
+Current output:
+-------- -------- -------- --------
+JUnit version 4.1
+.findStatic
+OpenJDK Server VM warning: JSR 292 invokedynamic is disabled in this JVM.  Use -XX:+EnableMethodHandles to enable.
+findStatic class jdk.java.dyn.MethodHandlesTest$Example.s0/()void => s0()void
+calling [s0, []] on s0()void
+:findStatic class jdk.java.dyn.MethodHandlesTest$Example.pkg_s0/()void => pkg_s0()void
+calling [pkg_s0, []] on pkg_s0()void
+:findStatic class jdk.java.dyn.MethodHandlesTest$Example.pri_s0/()void => pri_s0()void
+calling [pri_s0, []] on pri_s0()void
+:findStatic class jdk.java.dyn.MethodHandlesTest$Example.s1/(java.lang.Object)java.lang.Object => s1(java.lang.Object)java.lang.Object
+calling [s1, [#1000000]] on s1(java.lang.Object)java.lang.Object
+:findStatic class jdk.java.dyn.MethodHandlesTest$Example.s2/(int)java.lang.Object => s2(int)java.lang.Object
+calling [s2, [1000001]] on s2(int)java.lang.Object
+:findStatic class jdk.java.dyn.MethodHandlesTest$Example.bogus/()void => null !! java.dyn.NoAccessException: cannot access: jdk.java.dyn.MethodHandlesTest$Example.bogus()void, from jdk.java.dyn.MethodHandlesTest$Example
+.findVirtual
+findVirtual class jdk.java.dyn.MethodHandlesTest$Example.v0/()void => v0(jdk.java.dyn.MethodHandlesTest$Example)void
+calling [v0, [Example#1000002]] on v0(jdk.java.dyn.MethodHandlesTest$Example)void
+:findVirtual class jdk.java.dyn.MethodHandlesTest$Example.pkg_v0/()void => pkg_v0(jdk.java.dyn.MethodHandlesTest$Example)void
+calling [pkg_v0, [Example#1000003]] on pkg_v0(jdk.java.dyn.MethodHandlesTest$Example)void
+:findVirtual class jdk.java.dyn.MethodHandlesTest$Example.pri_v0/()void => pri_v0(jdk.java.dyn.MethodHandlesTest$Example)void
+calling [pri_v0, [Example#1000004]] on pri_v0(jdk.java.dyn.MethodHandlesTest$Example)void
+:findVirtual class jdk.java.dyn.MethodHandlesTest$Example.v1/(java.lang.Object)java.lang.Object => v1(jdk.java.dyn.MethodHandlesTest$Example,java.lang.Object)java.lang.Object
+calling [v1, [Example#1000005, #1000006]] on v1(jdk.java.dyn.MethodHandlesTest$Example,java.lang.Object)java.lang.Object
+:findVirtual class jdk.java.dyn.MethodHandlesTest$Example.v2/(java.lang.Object,java.lang.Object)java.lang.Object => v2(jdk.java.dyn.MethodHandlesTest$Example,java.lang.Object,java.lang.Object)java.lang.Object
+calling [v2, [Example#1000007, #1000008, #1000009]] on v2(jdk.java.dyn.MethodHandlesTest$Example,java.lang.Object,java.lang.Object)java.lang.Object
+:findVirtual class jdk.java.dyn.MethodHandlesTest$Example.v2/(java.lang.Object,int)java.lang.Object => v2(jdk.java.dyn.MethodHandlesTest$Example,java.lang.Object,int)java.lang.Object
+calling [v2, [Example#1000010, #1000011, 1000012]] on v2(jdk.java.dyn.MethodHandlesTest$Example,java.lang.Object,int)java.lang.Object
+:findVirtual class jdk.java.dyn.MethodHandlesTest$Example.v2/(int,java.lang.Object)java.lang.Object => v2(jdk.java.dyn.MethodHandlesTest$Example,int,java.lang.Object)java.lang.Object
+calling [v2, [Example#1000013, 1000014, #1000015]] on v2(jdk.java.dyn.MethodHandlesTest$Example,int,java.lang.Object)java.lang.Object
+:findVirtual class jdk.java.dyn.MethodHandlesTest$Example.v2/(int,int)java.lang.Object => v2(jdk.java.dyn.MethodHandlesTest$Example,int,int)java.lang.Object
+calling [v2, [Example#1000016, 1000017, 1000018]] on v2(jdk.java.dyn.MethodHandlesTest$Example,int,int)java.lang.Object
+:findVirtual class jdk.java.dyn.MethodHandlesTest$Example.bogus/()void => null !! java.dyn.NoAccessException: cannot access: jdk.java.dyn.MethodHandlesTest$Example.bogus()void, from jdk.java.dyn.MethodHandlesTest
+findVirtual class jdk.java.dyn.MethodHandlesTest$SubExample.Sub/v0/()void => v0(jdk.java.dyn.MethodHandlesTest$SubExample)void
+calling [Sub/v0, [SubExample#1000019]] on v0(jdk.java.dyn.MethodHandlesTest$SubExample)void
+:findVirtual class jdk.java.dyn.MethodHandlesTest$Example.Sub/v0/()void => v0(jdk.java.dyn.MethodHandlesTest$Example)void
+calling [Sub/v0, [SubExample#1000021]] on v0(jdk.java.dyn.MethodHandlesTest$Example)void
+:findVirtual interface jdk.java.dyn.MethodHandlesTest$IntExample.Sub/v0/()void => v0(jdk.java.dyn.MethodHandlesTest$IntExample)void
+calling [Sub/v0, [SubExample#1000023]] on v0(jdk.java.dyn.MethodHandlesTest$IntExample)void
+:findVirtual class jdk.java.dyn.MethodHandlesTest$SubExample.Sub/pkg_v0/()void => pkg_v0(jdk.java.dyn.MethodHandlesTest$SubExample)void
+calling [Sub/pkg_v0, [SubExample#1000024]] on pkg_v0(jdk.java.dyn.MethodHandlesTest$SubExample)void
+:findVirtual class jdk.java.dyn.MethodHandlesTest$Example.Sub/pkg_v0/()void => pkg_v0(jdk.java.dyn.MethodHandlesTest$Example)void
+calling [Sub/pkg_v0, [SubExample#1000026]] on pkg_v0(jdk.java.dyn.MethodHandlesTest$Example)void
+:findVirtual interface jdk.java.dyn.MethodHandlesTest$IntExample.v0/()void => v0(jdk.java.dyn.MethodHandlesTest$IntExample)void
+calling [v0, [Example#1000028]] on v0(jdk.java.dyn.MethodHandlesTest$IntExample)void
+:findVirtual interface jdk.java.dyn.MethodHandlesTest$IntExample.Int/v0/()void => v0(jdk.java.dyn.MethodHandlesTest$IntExample)void
+calling [Int/v0, [jdk.java.dyn.MethodHandlesTest$IntExample$Impl@29428e]] on v0(jdk.java.dyn.MethodHandlesTest$IntExample)void
+:I.bind
+bind Example#1000031.v0/()void => Bound[v0()void]
+calling [v0, []] on Bound[v0()void]
+:bind Example#1000032.pkg_v0/()void => Bound[pkg_v0()void]
+calling [pkg_v0, []] on Bound[pkg_v0()void]
+:bind Example#1000033.pri_v0/()void => Bound[pri_v0()void]
+calling [pri_v0, []] on Bound[pri_v0()void]
+:bind Example#1000034.v1/(java.lang.Object)java.lang.Object => Bound[v1(java.lang.Object)java.lang.Object]
+calling [v1, [#1000035]] on Bound[v1(java.lang.Object)java.lang.Object]
+:bind Example#1000036.v2/(java.lang.Object,java.lang.Object)java.lang.Object => Bound[v2(java.lang.Object,java.lang.Object)java.lang.Object]
+calling [v2, [#1000037, #1000038]] on Bound[v2(java.lang.Object,java.lang.Object)java.lang.Object]
+:bind Example#1000039.v2/(java.lang.Object,int)java.lang.Object => Bound[v2(java.lang.Object,int)java.lang.Object]
+calling [v2, [#1000040, 1000041]] on Bound[v2(java.lang.Object,int)java.lang.Object]
+:bind Example#1000042.v2/(int,java.lang.Object)java.lang.Object => Bound[v2(int,java.lang.Object)java.lang.Object]
+calling [v2, [1000043, #1000044]] on Bound[v2(int,java.lang.Object)java.lang.Object]
+:bind Example#1000045.v2/(int,int)java.lang.Object => Bound[v2(int,int)java.lang.Object]
+calling [v2, [1000046, 1000047]] on Bound[v2(int,int)java.lang.Object]
+:bind Example#1000048.bogus/()void => null !! java.dyn.NoAccessException: cannot access: jdk.java.dyn.MethodHandlesTest$Example.bogus()void, from jdk.java.dyn.MethodHandlesTest
+bind SubExample#1000049.Sub/v0/()void => Bound[v0()void]
+calling [Sub/v0, []] on Bound[v0()void]
+:bind SubExample#1000050.Sub/pkg_v0/()void => Bound[pkg_v0()void]
+calling [Sub/pkg_v0, []] on Bound[pkg_v0()void]
+:bind jdk.java.dyn.MethodHandlesTest$IntExample$Impl@b1b4c3.Int/v0/()void => Bound[v0()void]
+calling [Int/v0, []] on Bound[v0()void]
+:.unreflect
+unreflect class jdk.java.dyn.MethodHandlesTest$Example.s0/()void => s0()void
+calling [s0, []] on s0()void
+:unreflect class jdk.java.dyn.MethodHandlesTest$Example.pkg_s0/()void => pkg_s0()void
+calling [pkg_s0, []] on pkg_s0()void
+:unreflect class jdk.java.dyn.MethodHandlesTest$Example.pri_s0/()void => pri_s0()void
+calling [pri_s0, []] on pri_s0()void
+:unreflect class jdk.java.dyn.MethodHandlesTest$Example.s1/(java.lang.Object)java.lang.Object => s1(java.lang.Object)java.lang.Object
+calling [s1, [#1000052]] on s1(java.lang.Object)java.lang.Object
+:unreflect class jdk.java.dyn.MethodHandlesTest$Example.s2/(int)java.lang.Object => s2(int)java.lang.Object
+calling [s2, [1000053]] on s2(int)java.lang.Object
+:unreflect class jdk.java.dyn.MethodHandlesTest$Example.v0/()void => v0(jdk.java.dyn.MethodHandlesTest$Example)void
+calling [v0, [Example#1000054]] on v0(jdk.java.dyn.MethodHandlesTest$Example)void
+:unreflect class jdk.java.dyn.MethodHandlesTest$Example.pkg_v0/()void => pkg_v0(jdk.java.dyn.MethodHandlesTest$Example)void
+calling [pkg_v0, [Example#1000055]] on pkg_v0(jdk.java.dyn.MethodHandlesTest$Example)void
+:unreflect class jdk.java.dyn.MethodHandlesTest$Example.pri_v0/()void => pri_v0(jdk.java.dyn.MethodHandlesTest$Example)void
+calling [pri_v0, [Example#1000056]] on pri_v0(jdk.java.dyn.MethodHandlesTest$Example)void
+:unreflect class jdk.java.dyn.MethodHandlesTest$Example.v1/(java.lang.Object)java.lang.Object => v1(jdk.java.dyn.MethodHandlesTest$Example,java.lang.Object)java.lang.Object
+calling [v1, [Example#1000057, #1000058]] on v1(jdk.java.dyn.MethodHandlesTest$Example,java.lang.Object)java.lang.Object
+:unreflect class jdk.java.dyn.MethodHandlesTest$Example.v2/(java.lang.Object,java.lang.Object)java.lang.Object => v2(jdk.java.dyn.MethodHandlesTest$Example,java.lang.Object,java.lang.Object)java.lang.Object
+calling [v2, [Example#1000059, #1000060, #1000061]] on v2(jdk.java.dyn.MethodHandlesTest$Example,java.lang.Object,java.lang.Object)java.lang.Object
+:unreflect class jdk.java.dyn.MethodHandlesTest$Example.v2/(java.lang.Object,int)java.lang.Object => v2(jdk.java.dyn.MethodHandlesTest$Example,java.lang.Object,int)java.lang.Object
+calling [v2, [Example#1000062, #1000063, 1000064]] on v2(jdk.java.dyn.MethodHandlesTest$Example,java.lang.Object,int)java.lang.Object
+:unreflect class jdk.java.dyn.MethodHandlesTest$Example.v2/(int,java.lang.Object)java.lang.Object => v2(jdk.java.dyn.MethodHandlesTest$Example,int,java.lang.Object)java.lang.Object
+calling [v2, [Example#1000065, 1000066, #1000067]] on v2(jdk.java.dyn.MethodHandlesTest$Example,int,java.lang.Object)java.lang.Object
+:unreflect class jdk.java.dyn.MethodHandlesTest$Example.v2/(int,int)java.lang.Object => v2(jdk.java.dyn.MethodHandlesTest$Example,int,int)java.lang.Object
+calling [v2, [Example#1000068, 1000069, 1000070]] on v2(jdk.java.dyn.MethodHandlesTest$Example,int,int)java.lang.Object
+:IIIII.convertArguments/pairwise
+convert id(java.lang.Object)java.lang.Object to (java.lang.String)java.lang.Object => Adapted[id](java.lang.String)java.lang.Object
+calling [id(java.lang.Object)java.lang.Object, [#1000071]] on Adapted[id](java.lang.String)java.lang.Object
+:convert id(java.lang.Object)java.lang.Object to (java.lang.Integer)java.lang.Object => Adapted[id](java.lang.Integer)java.lang.Object
+calling [id(java.lang.Object)java.lang.Object, [1000072]] on Adapted[id](java.lang.Integer)java.lang.Object
+:convert id(java.lang.Object)java.lang.Object to (int)java.lang.Object => Bound[<unknown>(int)java.lang.Object]
+calling [id(java.lang.Object)java.lang.Object, [1000073]] on Bound[<unknown>(int)java.lang.Object]
+:convert id(java.lang.Object)java.lang.Object to (short)java.lang.Object => Bound[<unknown>(short)java.lang.Object]
+calling [id(java.lang.Object)java.lang.Object, [17034]] on Bound[<unknown>(short)java.lang.Object]
+:IIIIIIII
+Time: 0.753
+
+OK (5 tests)
+
+-------- -------- -------- --------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netbeans/meth/TEST.sh	Fri May 08 14:24:28 2009 -0700
@@ -0,0 +1,16 @@
+#! /bin/ksh
+
+# Config setup:
+#NetBeansResources="/Applications/NetBeans/NetBeans 6.5.app/Contents/Resources"
+#export JUNIT4_JAR="$NetBeansResources/NetBeans/platform9/modules/ext/junit-4.5.jar"
+#export JUNIT4_JAR=$HOME/env/jars/junit-4.1.jar  #(or wherever you have it stashed)
+: ${JAVA7X_HOME?'point this at a recent build of JDK7, with JSR 292 extensions added'}
+: ${JUNIT4_JAR?'point this at a download of JUnit 4.1 (or 4.5, etc.)'}
+: ${DAVINCI?'point this at the parent directory of the patches and sources of your mlvm download'}
+export mhproj="$DAVINCI/patches/netbeans/meth"
+export cpath="$mhproj/build/classes:$mhproj/build/test/classes:${JUNIT4_JAR}"
+export java7=${JAVA7X_HOME}/bin/java
+[ -d "$mhproj" ] || { echo "*** Not a directory: $mhproj"; exit 2; }
+
+$java7 -XX:+EnableMethodHandles -Xbootclasspath/p:"$cpath" jdk.java.dyn.MethodHandleDemo
+$java7 -XX:+EnableMethodHandles -Xbootclasspath/p:"$cpath" org.junit.runner.JUnitCore jdk.java.dyn.MethodHandlesTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netbeans/meth/build.xml	Fri May 08 14:24:28 2009 -0700
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See commented blocks below for -->
+<!-- some examples of how to customize the build. -->
+<!-- (If you delete it and reopen the project it will be recreated.) -->
+<project name="MethodHandle" default="default" basedir=".">
+    <description>Builds, tests, and runs the project MethodHandle.</description>
+    <import file="nbproject/build-impl.xml"/>
+
+    <property name="javadoc.includes" value="java/dyn/*.java"/>
+
+    <!--- build a bundle of the tests -->
+    <target name="-post-compile-test">
+        <echo message="make build/test-classes.jar from ${build.test.classes.dir}"/>
+        <jar compress="${jar.compress}" jarfile="${build.dir}/test-classes.jar">
+            <fileset dir="${build.test.classes.dir}"/>
+        </jar>
+    </target>
+
+    <target depends="init" name="-javadoc-build">
+        <mkdir dir="${dist.javadoc.dir}"/>
+        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" executable="${platform.javadoc}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"
+         verbose="yes"
+         public="yes"
+         >
+            <classpath>
+                <path path="${javac.classpath}"/>
+            </classpath>
+            <fileset dir="${src.src.dir}" excludes="${excludes}" includes="${javadoc.includes}">
+                <filename name="**/*.java"/>
+            </fileset>
+        </javadoc>
+    </target>
+
+
+    <!--
+
+    There exist several targets which are by default empty and which can be 
+    used for execution of your tasks. These targets are usually executed 
+    before and after some main targets. They are: 
+
+      -pre-init:                 called before initialization of project properties
+      -post-init:                called after initialization of project properties
+      -pre-compile:              called before javac compilation
+      -post-compile:             called after javac compilation
+      -pre-compile-single:       called before javac compilation of single file
+      -post-compile-single:      called after javac compilation of single file
+      -pre-compile-test:         called before javac compilation of JUnit tests
+      -post-compile-test:        called after javac compilation of JUnit tests
+      -pre-compile-test-single:  called before javac compilation of single JUnit test
+      -post-compile-test-single: called after javac compilation of single JUunit test
+      -pre-jar:                  called before JAR building
+      -post-jar:                 called after JAR building
+      -post-clean:               called after cleaning build products
+
+    (Targets beginning with '-' are not intended to be called on their own.)
+
+    Example of inserting an obfuscator after compilation could look like this:
+
+        <target name="-post-compile">
+            <obfuscate>
+                <fileset dir="${build.classes.dir}"/>
+            </obfuscate>
+        </target>
+
+    For list of available properties check the imported 
+    nbproject/build-impl.xml file. 
+
+
+    Another way to customize the build is by overriding existing main targets.
+    The targets of interest are: 
+
+      -init-macrodef-javac:     defines macro for javac compilation
+      -init-macrodef-junit:     defines macro for junit execution
+      -init-macrodef-debug:     defines macro for class debugging
+      -init-macrodef-java:      defines macro for class execution
+      -do-jar-with-manifest:    JAR building (if you are using a manifest)
+      -do-jar-without-manifest: JAR building (if you are not using a manifest)
+      run:                      execution of project 
+      -javadoc-build:           Javadoc generation
+      test-report:              JUnit report generation
+
+    An example of overriding the target for project execution could look like this:
+
+        <target name="run" depends="MethodHandle-impl.jar">
+            <exec dir="bin" executable="launcher.exe">
+                <arg file="${dist.jar}"/>
+            </exec>
+        </target>
+
+    Notice that the overridden target depends on the jar target and not only on 
+    the compile target as the regular run target does. Again, for a list of available 
+    properties which you can use, check the target you are overriding in the
+    nbproject/build-impl.xml file. 
+
+    -->
+
+<!--- hack to print props -->
+    <target depends="init" name="show-config">
+        <echoproperties regex="^(run|platform|config)(\.|$)"/>
+    </target>
+
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netbeans/meth/nbproject/project.properties	Fri May 08 14:24:28 2009 -0700
@@ -0,0 +1,105 @@
+application.args=
+application.title=MethodHandle
+application.vendor=jrose
+auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
+auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
+auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=default
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+debug.classpath=\
+    ${run.classpath}
+debug.test.classpath=\
+    ${run.test.classpath}
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/meth.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+####config.run.jvmargs=-XX:+EnableInvokeDynamic
+####excludes=
+excludes=jdk/java/dyn/*Dynamic*
+#excludes=java/dyn/Anonymous*.java,java/dyn/*ConstantPool*.java,jdk/java/dyn/Anonymous*.java,links/**
+#file.reference.bsd-i586-classes=../davinci/sources/build/bsd-i586/classes
+file.reference.test-classes=build/test/classes
+includes=java/dyn/**,jdk/java/dyn/**,sun/dyn/**
+#includes=**
+jar.compress=true
+javac.classpath=
+#    ${file.reference.bsd-i586-classes}
+# Space-separated list of extra javac options
+# assuming full JDK_7X:
+#javac.compilerargs=-Xlint:unchecked -XDinvokedynamic -nowarn -Xlint:none
+# without full JDK_7X:
+javac.compilerargs=-Xlint:unchecked -J-Xbootclasspath/p:${reference.langtools-javac.jar} -XDinvokedynamic \
+ -Xbootclasspath/p:${build.classes.dir}
+javac.deprecation=false
+javac.source=1.6
+javac.target=1.6
+javac.test.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}:\
+    ${libs.junit_4.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=
+javadoc.noindex=true
+javadoc.nonavbar=true
+javadoc.notree=true
+javadoc.private=false
+javadoc.splitindex=false
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+jnlp.codebase.type=local
+jnlp.codebase.url=file:/Users/jrose/Projects/MethodHandle/dist/
+jnlp.descriptor=application
+jnlp.enabled=false
+jnlp.offline-allowed=false
+jnlp.signed=false
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+platform.active=JDK_1.6
+# was on javac.classpath, run.classpath: ${reference.AnonymousClass.jar}
+#project.AnonymousClass=../anonk
+run.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}:\
+    ${file.reference.test-classes}
+# Space-separated list of JVM arguments used when running the project
+# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
+# or test-sys-prop.name=value to set system properties for unit tests):
+run.jvmargs=${config.run.jvmargs} -Xbootclasspath/p:"${run.classpath}:${libs.junit_4.classpath}"
+#manual hack: override ${config.run.jvmargs} in ${config}.properties
+config.run.jvmargs=-XX:+EnableMethodHandles
+run.test.classpath=\
+    ${javac.test.classpath}:\
+    ${build.test.classes.dir}
+source.encoding=UTF-8
+# One or more refs probably need fixing:
+file.reference.projects=${user.home}/Projects
+file.reference.davinci.sources.jdk=${file.reference.projects}/davinci/sources/jdk
+reference.langtools-javac.jar=${platforms.JDK_7X.home}/lib/tools.jar
+#was: reference.langtools-javac.jar=${project.langtools}/dist/bootstrap/lib/javac.jar
+#was: reference.langtools-javac.jar=${project.langtools}/dist/bootstrap/lib/javac.jar
+src.src.dir=${file.reference.davinci.sources.jdk}/src/share/classes
+test.src.dir=test
+project.license=openjdk
+davinci.patch.name=meth
+# JDK_7X = an mlvm build, including JSR 292 javac from langtools, libjvm from hotspot, and rt.jar from jvm
+# these should be globally defined in most setups, but are given here locally for completeness:
+platforms.JDK_7X.bootclasspath=${platforms.JDK_7X.home}/jre/lib/resources.jar:${platforms.JDK_7X.home}/jre/lib/rt.jar:${platforms.JDK_7X.home}/jre/lib/sunrsasign.jar:${platforms.JDK_7X.home}/jre/lib/jsse.jar:${platforms.JDK_7X.home}/jre/lib/jce.jar:${platforms.JDK_7X.home}/jre/lib/charsets.jar:${platforms.JDK_7X.home}/jre/classes:${platforms.JDK_7X.home}/jre/lib/ext/dnsns.jar:${platforms.JDK_7X.home}/jre/lib/ext/localedata.jar:${platforms.JDK_7X.home}/jre/lib/ext/sunjce_provider.jar:${platforms.JDK_7X.home}/jre/lib/ext/sunpkcs11.jar
+platforms.JDK_7X.compiler=modern
+platforms.JDK_7X.home=${user.home}/env/JAVA7X_HOME
+# e.g., ln -s ...davinci/sources/build/bsd-i586/j2sdk-image ~/env/JAVA7X_HOME
+#platforms.JDK_7X.home=${project.davinci}/sources/build/bsd-i586
+#project.davinci=${user.home}/Projects/davinci/j2sdk-image
+libs.junit_4.classpath=${user.home}/env/jars/junit-4.1.jar
+platform.java=${platforms.JDK_7X.home}/bin/java
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netbeans/meth/nbproject/project.xml	Fri May 08 14:24:28 2009 -0700
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.java.j2seproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
+            <name>meth</name>
+            <minimum-ant-version>1.6.5</minimum-ant-version>
+            <explicit-platform explicit-source-supported="true"/>
+            <source-roots>
+                <root id="src.src.dir" name="JDK Source Packages"/>
+            </source-roots>
+            <test-roots>
+                <root id="test.src.dir"/>
+            </test-roots>
+        </data>
+    </configuration>
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netbeans/meth/test/jdk/java/dyn/HelloDynamic.java	Fri May 08 14:24:28 2009 -0700
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6754038
+ * @summary Hello world, JSR 292 style
+ * @author jrose
+ */
+/*
+ * Standalone testing:
+ * <code>
+ * $ cd $MY_REPO_DIR/langtools
+ * $ (cd make; make)
+ * $ .../langtools/dist/bootstrap/bin/javac -d dist .../Hello.java
+ * $ javap -c -classpath dist jdk.java.dyn.Hello
+ * </code>
+ *
+ * @run Hello.java
+ */
+
+package jdk.java.dyn;
+import org.junit.*;
+
+import java.dyn.*;
+
+public class HelloDynamic {
+    @Test public void test() { main("Fred"); }
+
+    public static void main(String... av) {
+        if (av.length == 0)  av = new String[] { "world" };
+        greeter(av[0] + " (from a statically linked call site)");
+        greete5(av[0] + " (from a statically linked call site)");
+        for (String whom : av) {
+            greeter.<void>invoke(whom);  // strongly typed direct call
+            greete5.invoke(whom);        // strongly typed direct call
+            // previous line generates invokevirtual MethodHandle.invoke(String)void
+            Object x = whom;
+            InvokeDynamic.hail(x);            // weakly typed invokedynamic
+            // previous line generates invokedynamic MethodHandle.invoke(Object)Object
+        }
+        System.out.println("Bye!");
+    }
+
+    static void greeter(String x) { System.out.println("Hello, "+x); }
+    // intentionally pun between the method and its reified handle:
+    static MethodHandle greeter
+        = MethodHandles.lookup().findStatic(HelloDynamic.class, "greeter",
+                                   MethodType.make(void.class, String.class));
+    //might be nice: MethodHandle greeter = Hello#greeter;
+
+    static Object greete5(String x) { System.out.println("H311o, "+x); return null; }
+    static MethodHandle greete5
+        = MethodHandles.lookup().findStatic(HelloDynamic.class, "greete5",
+                                   MethodType.make(Object.class, String.class));
+    // Set up a class-local bootstrap method.
+    static { Linkage.registerBootstrapMethod("bootstrapDynamic"); }
+    private static CallSite bootstrapDynamic(Class caller, String name, MethodType type) {
+        assert(type.parameterCount() == 1 && name == "hail");  // in lieu of MOP
+        System.out.println("set site target to "+greete5);
+        CallSite site = new CallSite(caller, name, type);
+        MethodHandle target = MethodHandles.convertArguments(greete5, site.type());
+        System.out.println("   with conversions: "+target);
+        site.setTarget(target);
+        return site;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netbeans/meth/test/jdk/java/dyn/InvokeDynamicDemo.java	Fri May 08 14:24:28 2009 -0700
@@ -0,0 +1,300 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package jdk.java.dyn;
+
+import sun.dyn.anon.ConstantPoolPatch;
+import sun.dyn.anon.AnonymousClassLoader;
+import java.dyn.*;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.regex.Pattern;
+import org.junit.*;
+//import static org.junit.Assert.*;
+import static jdk.java.dyn.JUnitAssert.*;
+
+public class InvokeDynamicDemo {
+
+    private interface FakeDynamic extends Dynamic {
+        int foo(int x);
+        String bar(String x, int y);
+    }
+
+    public static int myFoo(Object recv, int z) {
+        println("myFoo "+recv+" "+z);
+        return z * 1000000;
+    }
+
+    public static String myBar(Object recv, String x, int y) {
+        println("myBar "+recv+" "+x+" "+y);
+        return "myBar"+Arrays.asList(recv, x, y);
+    }
+
+    static class IDUser implements Runnable {
+        static String options = "FAKE_OPTIONS";
+        static boolean hasOption(String x) {
+            return options.indexOf(x) >= 0;
+        }
+
+        @Override
+        public void run() {
+            useit("baz", "bat", 123);
+        }
+
+        void useit(Object x, Object y, int z) {
+            int fooval = fakeIdentity(x).foo(z);
+            println("foo => "+fooval);
+            assertEquals(myFoo(x, z), fooval);
+            String barval = fakeIdentity(x).bar((String)y, z);
+            println("bar => "+barval);
+            assertEquals(myBar(x, (String)y, z), barval);
+        }
+
+        public // %%% FIXME: findStatic only finds public methods right now
+        static Object bootstrap(CallSite site, Object... args) {
+            println("bootstrap "+site+Arrays.asList(args));
+            // a bootstrap method can be very stupid:
+            if (hasOption("boot-gc"))
+                Runtime.getRuntime().gc();
+            if (hasOption("boot-null"))
+                return null;
+            if (hasOption("boot-bad"))
+                return Arrays.asList(args);   // neither a String nor an Integer
+            if (hasOption("boot-string"))
+                return "boot";
+            if (hasOption("boot-int"))
+                return 8007;
+            if (hasOption("boot-throw"))
+                throw new RuntimeException("boot-throw!");
+            // or it can actually look at the call site:
+            Object name = site.name();
+            if (name == "foo") {
+                if (hasOption("boot-con"))
+                    return 8007000;  // it does not need to set a target...
+                MethodHandle myFoo = MethodHandles.findStatic(InvokeDynamicDemo.class, "myFoo", site.type());
+                println("setTarget myFoo: "+myFoo);
+                site.setTarget(myFoo);
+                return myFoo(args[0], (Integer) args[1]);
+            }
+            if (name == "bar") {
+                if (hasOption("boot-con"))
+                    return "boot con!";  // it does not need to set a target...
+                MethodHandle myBar = MethodHandles.findStatic(InvokeDynamicDemo.class, "myBar", site.type());
+                println("setTarget myBar: "+myBar);
+                site.setTarget(myBar);
+                return myBar(args[0], (String) args[1], (Integer) args[2]);
+            }
+            throw new RuntimeException("name not recognized: "+name);
+        }
+
+        static {
+            println("options: "+options);
+            MethodType type = Linkage.BOOTSTRAP_METHOD_TYPE;
+            MethodHandle mh = MethodHandles.findStatic(IDUser.class, "bootstrap", type);
+            if (mh == null)
+                println("missing bootstrap"+type);
+            else
+                println("register bootstrap: "+mh);
+            Linkage.registerBootstrapMethod(IDUser.class, mh);
+        }
+    }
+    static FakeDynamic fakeIdentity(Object x) {
+        return (FakeDynamic)x;
+    }
+    static Object identity(Object x) {
+        return x;
+    }
+
+    static boolean verbose;
+    static void println(String x) {
+        if (verbose)  System.out.println(x);
+    }
+
+    @Test public void run() throws Exception { run(new String[0]); }
+
+    public static void run(String... av) throws Exception {
+        final HashMap<String,String> utf8Map = new HashMap<String,String>();
+        utf8Map.put("fakeIdentity", "identity");
+        String objbcn = Object.class.getName().replace('.', '/');
+        String objsig = "L"+objbcn+";";
+        String fdbcn = FakeDynamic.class.getName().replace('.', '/');
+        String rdbcn = Dynamic.class.getName().replace('.', '/');
+        utf8Map.put(fdbcn, rdbcn);
+        String fakesig = "("+objsig+")L"+fdbcn+";";
+        utf8Map.put(fakesig, fakesig.replaceAll(Pattern.quote(fdbcn), objbcn));
+        utf8Map.put("FAKE_OPTIONS", Arrays.asList(av).toString());
+        System.out.println("utf8Map: "+utf8Map);
+        final ConstantPoolPatch patch = new ConstantPoolPatch(IDUser.class);
+        patch.putPatches(utf8Map, null, null, true);
+        if (!utf8Map.isEmpty())
+            throw new AssertionError("Map not empty: "+utf8Map);
+        Class anonk = new AnonymousClassLoader(IDUser.class).loadClass(patch);
+        Object user = anonk.newInstance();
+        System.out.println("Running test on new object "+user);
+        int count = 1;
+        verbose = true;
+        for (String arg : av) {
+            if (arg.startsWith("count-"))
+                count = Integer.parseInt(arg.substring("count-".length(), arg.length()));
+        }
+        if (count != 1)  System.out.println("run count: "+count);
+        for (int i = 0; i < count; i++) {
+            if (i > 10) {
+                if (i > count - 10)
+                    verbose = true;
+                else if (verbose) {
+                    println("...shutting up...");
+                    verbose = false;
+                }
+            }
+            ((Runnable)user).run();
+        }
+    }
+
+    // Extra entry point for standalone use.  Use as follows:
+    //junit="$NetBeansResources/NetBeans/java2/modules/ext/junit-4.1.jar"
+    //anonk="../AnonymousClass/dist/AnonymousClass.jar"
+    //cpath="$anonk:build/classes:build/test/classes:$junit"
+    //java -Xbootclasspath/p:"$cpath" jdk.java.dyn.MethodHandleBytecodeTest
+    public static void main(String... av) throws Throwable {
+        System.out.println("running ID demo");
+        run(av);
+        //new JUnit4TestAdapter(InvokeDynamicDemo.class).run(null);
+    }
+}
+
+/* --- SAMPLE OUTPUT ---
+--------
+	./gamma -XX:+EnableInvokeDynamic -Xbootclasspath/p:"$cpath" jdk.java.dyn.InvokeDynamicDemo count-1000
+VM option '+PrintCompilation'
+VM option '+VerifyBeforeGC'
+VM option '+MethodHandles'
+VM option '+InvokeDynamic'
+[Verifying threads permgen tenured generation def new generation remset ref_proc syms strs zone dict hand C-heap ]
+running ID demo
+utf8Map: {fakeIdentity=identity, jdk/java/dyn/InvokeDynamicDemo$FakeDynamic=java/dyn/Dynamic, (Ljava/lang/Object;)Ljdk/java/dyn/InvokeDynamicDemo$FakeDynamic;=(Ljava/lang/Object;)Ljava/lang/Object;, FAKE_OPTIONS=[count-1000]}
+  1       java.lang.String::charAt (33 bytes)
+  2       java.lang.String::hashCode (60 bytes)
+Running test on new object jdk.java.dyn.InvokeDynamicDemo$IDUser/29596205@eb7859
+run count: 1000
+reporting bootstrap method to JVM: bootstrap:(java.dyn.CallSite,java.lang.Object...)java.lang.Object
+DynCallSite: CallSite#23491286[foo(java.lang.Object,int)int => null]
+bootstrap CallSite#23491286[foo(java.lang.Object,int)int => null][baz, 123]
+setTarget myFoo: myFoo:(java.lang.Object,int)int
+myFoo baz 123
+foo => 123000000
+DynCallSite: CallSite#21061094[bar(java.lang.Object,java.lang.String,int)java.lang.String => null]
+bootstrap CallSite#21061094[bar(java.lang.Object,java.lang.String,int)java.lang.String => null][baz, bat, 123]
+setTarget myBar: myBar:(java.lang.Object,java.lang.String,int)java.lang.String
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+...shutting up...
+  3       java.lang.Object::<init> (1 bytes)
+ VerifyBeforeGC:[Verifying threads permgen tenured generation def new generation remset ref_proc syms strs zone dict hand C-heap ]
+---   n   java.lang.System::arraycopy (static)
+  4       java.lang.String::getChars (66 bytes)
+  5       java.lang.AbstractStringBuilder::append (60 bytes)
+  6       java.lang.StringBuilder::append (8 bytes)
+  7       java.lang.Integer::getChars (131 bytes)
+  8       java.lang.AbstractStringBuilder::stringSizeOfInt (21 bytes)
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+myFoo baz 123
+foo => 123000000
+myBar baz bat 123
+bar => myBar[baz, bat, 123]
+--------
+ * --- */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netbeans/meth/test/jdk/java/dyn/JUnitAssert.java	Fri May 08 14:24:28 2009 -0700
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package jdk.java.dyn;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * Local stub for running without junit.jar.
+ * To use, copy this file to your package, and add this to the per-file imports:
+ * <code>
+ * //import static org.junit.Assert.*;
+ * import static whatever.this.package.is.JUnitAssert.*;
+ * </code>
+ * @author jrose
+ */
+class JUnitAssert {
+    static void assertSame(Object expected, Object actual) {
+        Method m = findMethod("assertSame", Object.class, Object.class);
+        if (m != null) {
+            callMethod(m, expected, actual);
+        } else if (expected != actual) {
+            error("not same", expected, actual);
+        }
+    }
+
+    static void assertEquals(Object expected, Object actual) {
+        if (!equals(expected, actual))
+            assertSame(expected, actual);
+    }
+
+    static boolean equals(Object x, Object y) {
+        return (x == y) || (x != null && y != null && x.equals(y));
+    }
+    
+    static void error(String message, Object expected, Object actual) {
+        throw new AssertionError(message+": expected ["+expected+"]"+
+                                   ", but result was ["+actual+"]");
+    }
+    
+    /// the rest is brute hackery...
+
+    static final Class<?> JUNIT_ASSERT;
+    static {
+        Class <?> JUNIT_ASSERT_ = null;
+        final String cname = "org.junit.Assert";
+        try {
+            JUNIT_ASSERT_ = Class.forName(cname);
+        } catch (ClassNotFoundException ee) {
+            System.out.println("Using backup methods instead of "+cname);
+        }
+        JUNIT_ASSERT = JUNIT_ASSERT_;
+    }
+
+    static final HashMap<List<Object>, Method> methods
+            = new HashMap<List<Object>, Method>();
+    static final Method NO_METHOD;
+    static {
+        Method noMethod = null;
+        try {
+            noMethod = JUnitAssert.class.getDeclaredMethod("noMethod");
+        } catch (Exception ee) {
+        }
+        NO_METHOD = noMethod; 
+    }
+    static private void noMethod() { }
+    
+    static Method findMethod(String name, Class<?>... params) {
+        if (JUNIT_ASSERT == null)  return null;
+        ArrayList<Object> key = new ArrayList<Object>(Arrays.asList(params));
+        key.add(0, name);
+        Method m = methods.get(key);
+        if (m != null)  return (m == NO_METHOD ? null : m);
+        try {
+            m = JUNIT_ASSERT.getMethod(name, params);
+        } catch (NoSuchMethodException ee) {
+            System.out.println("Missing method: "+name+Arrays.asList(params));
+        }
+        methods.put(key, (m == null ? NO_METHOD : m));
+        return m;
+    }
+    static Object callMethod(Method m, Object... params) {
+        Throwable bad;
+        try {
+            return m.invoke(null, params);
+        } catch (InvocationTargetException ite) {
+            Throwable ee = ite.getTargetException();
+            if (ee instanceof RuntimeException)
+                throw (RuntimeException)ee;
+            if (ee instanceof Error)
+                throw (Error)ee;
+            bad = ee;
+        } catch (Exception ee) {
+            bad = ee;
+        }
+        throw new Error("unexpected reflection problem", bad);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netbeans/meth/test/jdk/java/dyn/MethodHandleBytecodeTest.java	Fri May 08 14:24:28 2009 -0700
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package jdk.java.dyn;
+
+import java.dyn.*;
+import java.dyn.MethodHandles.Lookup;
+import java.lang.reflect.Method;
+import junit.framework.JUnit4TestAdapter;
+import org.junit.*;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author jrose
+ */
+public class MethodHandleBytecodeTest {
+    private Method toString, compareTo, getBytes;
+
+    private static final Lookup METHODS = MethodHandles.lookup();
+
+    @Before
+    public void setUp() throws Exception {
+        toString = Object.class.getDeclaredMethod("toString");
+        compareTo = Comparable.class.getDeclaredMethod("compareTo", Object.class);
+        getBytes = String.class.getDeclaredMethod("getBytes", String.class);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    /**
+     * Test of invoke pseudo-method, of class MethodHandle.
+     */
+    @Test
+    public void testToString() {
+        System.out.println("invoke toString");
+        MethodHandle instance = METHODS.findVirtual(
+                Object.class, "toString", MethodType.make(String.class) );
+        String foo = "foo";
+        String expResult = foo.toString();
+        String result = invokeToString(instance, foo);
+        System.out.println("result = "+result);
+        assertEquals(expResult, result);
+    }
+
+    private String invokeToString(MethodHandle mh, Object obj) {
+        System.out.println("invoke mh="+mh);
+        return (String) MethodHandles.invoke_1(mh, obj);
+    }
+
+    // Extra entry point for standalone use.  Use as follows:
+    //junit="$NetBeansResources/NetBeans/java2/modules/ext/junit-4.1.jar"
+    //anonk="../AnonymousClass/dist/AnonymousClass.jar"
+    //cpath="$anonk:build/classes:build/test/classes:$junit"
+    //java -Xbootclasspath/p:"$cpath" jdk.java.dyn.MethodHandleBytecodeTest
+    public static void main(String... av) throws Throwable {
+        new JUnit4TestAdapter(MethodHandleBytecodeTest.class).run(null);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netbeans/meth/test/jdk/java/dyn/MethodHandleDemo.java	Fri May 08 14:24:28 2009 -0700
@@ -0,0 +1,171 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package jdk.java.dyn;
+
+import java.dyn.*;
+import java.dyn.MethodHandles.Lookup;
+
+import org.junit.*;
+//import static org.junit.Assert.*;
+import static jdk.java.dyn.JUnitAssert.*;
+
+public class MethodHandleDemo {
+    static String options = "";
+    static boolean hasOption(String x) {
+        return options.indexOf(x) >= 0;
+    }
+    static boolean verbose = true;
+    static void println(Object x) {
+        if (verbose)  System.out.println(x);
+    }
+
+    public static void main(String... av) {
+        assertSame("hello", "hello");  // exercise assertion stuff first
+
+        options = java.util.Arrays.asList(av).toString();
+        int count = 1;
+        verbose = true;
+        for (String arg : av) {
+            if (arg.startsWith("count-"))
+                count = Integer.parseInt(arg.substring("count-".length(), arg.length()));
+        }
+        if (count != 1)  println("run count: "+count);
+        for (int i = 0; i < count; i++) {
+            if (i > 10) {
+                if (i > count - 10)
+                    verbose = true;
+                else if (verbose) {
+                    println("...shutting up...");
+                    verbose = false;
+                }
+            }
+            test();
+        }
+    }
+
+    static void test() {
+        Class caller = MethodHandleDemo.class;
+        Class returnType = String.class;
+        Class[] signature = {String.class};
+        String result;
+        Lookup lookup = MethodHandles.lookup();
+        MethodHandle mh;
+        mh = lookup.findVirtual(Object.class,
+                "toString", MethodType.make(String.class));
+        println("calling "+mh);
+        result = mh.<String>invoke((Object)"foo");
+        assertSame("foo", result);
+
+        mh = lookup.findStatic(MethodHandleDemo.class,
+                "test0", MethodType.make(String.class));
+        println("calling "+mh);
+        result = mh.<String>invoke();
+        assertEquals("[test0]", result);
+
+        mh = lookup.findStatic(MethodHandleDemo.class,
+                "test1", MethodType.make(String.class, String.class));
+        println("calling "+mh);
+        result = mh.<String>invoke("X");
+        assertEquals("[test1 X]", result);
+        
+        mh = MethodHandles.insertArgument(mh, 0, "Bounderby");
+        println("calling bound "+mh);
+        result = mh.<String>invoke();
+        assertEquals("[test1 Bounderby]", result);
+
+        mh = lookup.findStatic(MethodHandleDemo.class,
+                "test2", MethodType.make(String.class, String.class, int.class));
+        println("calling "+mh);
+        result = mh.<String>invoke("X", 123);
+        assertEquals("[test2 X #123]", result);
+
+        mh = MethodHandles.insertArgument(mh, 0, "Buster");
+        println("calling bound "+mh);
+        result = mh.<String>invoke(456);
+        assertEquals("[test2 Buster #456]", result);
+
+        Obj obj = new Obj("X");
+        mh = lookup.findVirtual(I.class,
+                "test1", MethodType.make(String.class));
+        println("calling "+mh);
+        result = mh.<String>invoke((I)obj);
+        assertEquals("[Obj.test1 X]", result);
+
+        mh = lookup.findVirtual(I.class,
+                "test2", MethodType.make(String.class, int.class));
+        println("calling "+mh);
+        result = mh.<String>invoke((I)obj, 123);
+        assertEquals("[Obj.test2 X #123]", result);
+    }
+
+    static void eachCall() {
+        if (hasOption("call-gc"))
+            Runtime.getRuntime().gc();
+    }
+
+    // static methods we make handles for:
+    public static String test0() {
+        eachCall();
+        return "[test0]";
+    }
+
+    public static String test1(String x) {
+        eachCall();
+        return "[test1 " + x + "]";
+    }
+
+    public static String test2(String x, int y) {
+        println("y == 0x"+Integer.toHexString(y));
+        eachCall();
+        return "[test2 " + x + " #" + y + "]";
+    }
+    
+    interface I {
+        String test1();
+        String test2(int y);
+    }
+
+    // virtual methods we make handles for:
+    static class Obj implements I {
+        String x;
+        Obj(String x) { this.x = x; }
+        public String test1() {
+            eachCall();
+            return "[Obj.test1 " + x + "]";
+        }
+        public String test2(int y) {
+            println("y == 0x"+Integer.toHexString(y));
+            eachCall();
+            return "[Obj.test2 " + x + " #" + y + "]";
+        }
+    }
+
+    // JUnit trimmings:
+    @Test
+    public void testMain() {
+        main();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netbeans/meth/test/jdk/java/dyn/MethodHandleSyntax.java	Fri May 08 14:24:28 2009 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package jdk.java.dyn;
+
+import java.dyn.*;
+
+public class MethodHandleSyntax {
+
+    public static void main(String... av) {
+        test();
+    }
+    static void test() {
+        MethodHandle mh = MethodHandles.lookup().findVirtual(Object.class,
+                "toString", MethodType.make(String.class));
+        System.out.println("calling "+mh);
+        // The following non-comment line will fail unless an enhanced
+        // javac.jar from JDK7 langtools is used to bulid this project.
+        // 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");
+        // Use this in ./nbproject/project.properties:
+        // project.langtools=../langtools
+        // reference.langtools-javac.jar=${project.langtools}/dist/bootstrap/lib/javac.jar
+        // javac.compilerargs=-Xlint:unchecked -J-Xbootclasspath/p:${reference.langtools-javac.jar} -XDinvokedynamic
+        if ((Object)"foo" != result)  throw new IllegalArgumentException(result);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netbeans/meth/test/jdk/java/dyn/MethodHandlesTest.java	Fri May 08 14:24:28 2009 -0700
@@ -0,0 +1,678 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package jdk.java.dyn;
+
+import sun.dyn.MemberName;
+import sun.dyn.util.Wrapper;
+import java.dyn.*;
+import java.dyn.MethodHandles.Lookup;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author jrose
+ */
+public class MethodHandlesTest {
+
+    public MethodHandlesTest() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+        calledLog.clear();
+        calledLog.add(null);
+        nextArg = 1000000;
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+    }
+
+    static List<Object> calledLog = new ArrayList<Object>();
+    static Object logEntry(String name, Object... args) {
+        return Arrays.asList(name, Arrays.asList(args));
+    }
+    static Object called(String name, Object... args) {
+        Object entry = logEntry(name, args);
+        calledLog.add(entry);
+        return entry;
+    }
+    static void assertCalled(String name, Object... args) {
+        Object expected = logEntry(name, args);
+        Object actual   = calledLog.get(calledLog.size() - 1);
+        if (expected.equals(actual))  return;
+        System.out.println("assertCalled "+name+":");
+        System.out.println("expected:   "+expected);
+        System.out.println("actual:     "+actual);
+        System.out.println("ex. types:  "+getClasses(expected));
+        System.out.println("act. types: "+getClasses(actual));
+        assertEquals("previous method call types", expected, actual);
+        assertEquals("previous method call", expected, actual);
+    }
+    static void printCalled(MethodHandle target, String name, Object... args) {
+        System.out.println("calling "+logEntry(name, args)+" on "+target);
+    }
+
+    static int nextArg;
+    static Object randomArg(Class<?> param) {
+        Wrapper wrap = Wrapper.forBasicType(param);
+        if (wrap == Wrapper.OBJECT && Wrapper.isWrapperType(param))
+            wrap = Wrapper.forWrapperType(param);
+        if (wrap != Wrapper.OBJECT)
+            return wrap.wrap(nextArg++);
+        else if (param.isInterface() || param.isAssignableFrom(String.class))
+            return "#"+(nextArg++);
+        else
+            try {
+                return param.newInstance();
+            } catch (InstantiationException ex) {
+            } catch (IllegalAccessException ex) {
+            }
+        return null;  // random class not Object, String, Integer, etc.
+    }
+    static Object[] randomArgs(Class<?>... params) {
+        Object[] args = new Object[params.length];
+        for (int i = 0; i < args.length; i++)
+            args[i] = randomArg(params[i]);
+        return args;
+    }
+
+    static <T, E extends T> T[] array(Class<T[]> atype, E... a) {
+        return Arrays.copyOf(a, a.length, atype);
+    }
+    static <T> T[] cat(T[] a, T... b) {
+        int alen = a.length, blen = b.length;
+        if (blen == 0)  return a;
+        T[] c = Arrays.copyOf(a, alen + blen);
+        System.arraycopy(b, 0, c, alen, blen);
+        return c;
+    }
+    static Integer[] boxAll(int... vx) {
+        Integer[] res = new Integer[vx.length];
+        for (int i = 0; i < res.length; i++) {
+            res[i] = vx[i];
+        }
+        return res;
+    }
+    static Object getClasses(Object x) {
+        if (x == null)  return x;
+        if (x instanceof String)  return x;  // keep the name
+        if (x instanceof List) {
+            // recursively report classes of the list elements
+            Object[] xa = ((List)x).toArray();
+            for (int i = 0; i < xa.length; i++)
+                xa[i] = getClasses(xa[i]);
+            return Arrays.asList(xa);
+        }
+        return x.getClass().getSimpleName();
+    }
+
+    static final Lookup LOOKUP = MethodHandles.lookup();
+
+    // Subject methods...
+    static class Example implements IntExample {
+        // Note:  This should be unnecessary.  Remove!
+        static final Lookup LOOKUP = MethodHandles.lookup();
+        final String name;
+        public Example() { name = "Example#"+(nextArg++); }
+        protected Example(String name) { this.name = name; }
+        protected Example(int x) { this(); called("protected <init>", this, x); }
+        @Override public String toString() { return name; }
+
+        public void            v0()     { called("v0", this); }
+        void                   pkg_v0() { called("pkg_v0", this); }
+        private void           pri_v0() { called("pri_v0", this); }
+        public static void     s0()     { called("s0"); }
+        static void            pkg_s0() { called("pkg_s0"); }
+        private static void    pri_s0() { called("pri_s0"); }
+
+        public Object          v1(Object x) { return called("v1", this, x); }
+        public Object          v2(Object x, Object y) { return called("v2", this, x, y); }
+        public Object          v2(Object x, int    y) { return called("v2", this, x, y); }
+        public Object          v2(int    x, Object y) { return called("v2", this, x, y); }
+        public Object          v2(int    x, int    y) { return called("v2", this, x, y); }
+        public static Object   s1(Object x) { return called("s1", x); }
+        public static Object   s2(int x)    { return called("s2", x); }
+        public static Object   s3(long x)   { return called("s3", x); }
+        public static Object   s4(int x, int y) { return called("s4", x, y); }
+        public static Object   s5(long x, int y) { return called("s5", x, y); }
+        public static Object   s6(int x, long y) { return called("s6", x, y); }
+
+        static MethodHandle findStatic(Class defc, String name, MethodType type) {
+            return LOOKUP.findStatic(defc, name, type);
+        }
+        static MethodHandle findVirtual(Class defc, String name, MethodType type) {
+            return LOOKUP.findVirtual(defc, name, type);
+        }
+        static MethodHandle unreflect(Method rmethod) {
+            return LOOKUP.unreflect(rmethod);
+        }
+    }
+    static class SubExample extends Example {
+        @Override public void  v0()     { called("Sub/v0", this); }
+        @Override void         pkg_v0() { called("Sub/pkg_v0", this); }
+        private      SubExample(int x)  { called("<init>", this, x); }
+        public SubExample() { super("SubExample#"+(nextArg++)); }
+        static MethodHandle findSpecial(Class defc, String name, MethodType type) {
+            return LOOKUP.findSpecial(defc, name, type, SubExample.class);
+        }
+    }
+    static interface IntExample {
+        public void            v0();
+        static class Impl implements IntExample {
+            public void        v0()     { called("Int/v0", this); }
+            final String name;
+            public Impl() { name = "Example#"+(nextArg++); }
+        }
+    }
+
+    // Set this true during development if you want to fast-forward to
+    // a particular new, non-working test.  Tests which are known to
+    // work (or have recently worked) test this flag and return on true.
+    static boolean CAN_SKIP_WORKING = false;
+    //static { CAN_SKIP_WORKING = true; }
+
+    @Test
+    public void testFindStatic() {
+        if (CAN_SKIP_WORKING)  return;
+        System.out.println("findStatic");
+        testFindStatic(Example.class, void.class, "s0");
+        testFindStatic(Example.class, void.class, "pkg_s0");
+        testFindStatic(Example.class, void.class, "pri_s0");
+
+        testFindStatic(Example.class, Object.class, "s1", Object.class);
+        testFindStatic(Example.class, Object.class, "s2", int.class);
+        //testFindStatic(Example.class, Object.class, "s3", long.class);
+        //testFindStatic(Example.class, Object.class, "s4", int.class, int.class);
+        //testFindStatic(Example.class, Object.class, "s5", long.class, int.class);
+        //testFindStatic(Example.class, Object.class, "s6", int.class, long.class);
+
+        testFindStatic(false, Example.class, void.class, "bogus");
+    }
+
+    void testFindStatic(Class<?> defc, Class<?> ret, String name, Class<?>... params) {
+        testFindStatic(true, defc, ret, name, params);
+    }
+    void testFindStatic(boolean positive, Class<?> defc, Class<?> ret, String name, Class<?>... params) {
+        MethodType type = MethodType.make(ret, params);
+        MethodHandle target = null;
+        RuntimeException noAccess = null;
+        try {
+            target = Example.findStatic(defc, name, type);
+        } catch (NoAccessException ex) {
+            noAccess = ex;
+        }
+        System.out.println("findStatic "+defc+"."+name+"/"+type+" => "+target
+                +(noAccess == null ? "" : " !! "+noAccess));
+        if (positive && noAccess != null)  throw noAccess;
+        assertEquals(positive, target != null);
+        if (!positive)  return; // negative test failed as expected
+        assertEquals(type, target.type());
+        Object[] args = randomArgs(params);
+        printCalled(target, name, args);
+        MethodHandles.invoke(target, args);
+        assertCalled(name, args);
+        System.out.print(':');
+    }
+
+    @Test
+    public void testFindVirtual() {
+        if (CAN_SKIP_WORKING)  return;
+        System.out.println("findVirtual");
+        testFindVirtual(Example.class, void.class, "v0");
+        testFindVirtual(Example.class, void.class, "pkg_v0");
+        testFindVirtual(Example.class, void.class, "pri_v0");
+        testFindVirtual(Example.class, Object.class, "v1", Object.class);
+        testFindVirtual(Example.class, Object.class, "v2", Object.class, Object.class);
+        testFindVirtual(Example.class, Object.class, "v2", Object.class, int.class);
+        testFindVirtual(Example.class, Object.class, "v2", int.class, Object.class);
+        testFindVirtual(Example.class, Object.class, "v2", int.class, int.class);
+        testFindVirtual(false, Example.class, Example.class, void.class, "bogus");
+        // test dispatch
+        testFindVirtual(SubExample.class,      SubExample.class, void.class, "Sub/v0");
+        testFindVirtual(SubExample.class,         Example.class, void.class, "Sub/v0");
+        testFindVirtual(SubExample.class,      IntExample.class, void.class, "Sub/v0");
+        testFindVirtual(SubExample.class,      SubExample.class, void.class, "Sub/pkg_v0");
+        testFindVirtual(SubExample.class,         Example.class, void.class, "Sub/pkg_v0");
+        testFindVirtual(Example.class,         IntExample.class, void.class, "v0");
+        testFindVirtual(IntExample.Impl.class, IntExample.class, void.class, "Int/v0");
+    }
+
+    void testFindVirtual(Class<?> defc, Class<?> ret, String name, Class<?>... params) {
+        testFindVirtual(defc, defc, ret, name, params);
+    }
+    void testFindVirtual(Class<?> rcvc, Class<?> defc, Class<?> ret, String name, Class<?>... params) {
+        testFindVirtual(true, rcvc, defc, ret, name, params);
+    }
+    void testFindVirtual(boolean positive, Class<?> rcvc, Class<?> defc, Class<?> ret, String name, Class<?>... params) {
+        String methodName = name.substring(1 + name.indexOf('/'));  // foo/bar => foo
+        MethodType type = MethodType.make(ret, params);
+        MethodHandle target = null;
+        RuntimeException noAccess = null;
+        try {
+            target = LOOKUP.findVirtual(defc, methodName, type);
+        } catch (NoAccessException ex) {
+            noAccess = ex;
+        }
+        System.out.println("findVirtual "+defc+"."+name+"/"+type+" => "+target
+                +(noAccess == null ? "" : " !! "+noAccess));
+        if (positive && noAccess != null)  throw noAccess;
+        assertEquals(positive, target != null);
+        if (!positive)  return; // negative test failed as expected
+        Class<?>[] paramsWithSelf = cat(array(Class[].class, (Class)defc), params);
+        MethodType typeWithSelf = MethodType.make(ret, paramsWithSelf);
+        assertEquals(typeWithSelf, target.type());
+        Object[] argsWithSelf = randomArgs(paramsWithSelf);
+        if (rcvc != defc)  argsWithSelf[0] = randomArg(rcvc);
+        printCalled(target, name, argsWithSelf);
+        MethodHandles.invoke(target, argsWithSelf);
+        assertCalled(name, argsWithSelf);
+        System.out.print(':');
+    }
+
+    @Test @Ignore("bug in VerifyAccess")
+    public void testFindSpecial() {
+        if (CAN_SKIP_WORKING)  return;
+        System.out.println("findSpecial");
+        testFindSpecial(Example.class, void.class, "v0");
+        testFindSpecial(Example.class, void.class, "pkg_v0");
+        testFindSpecial(SubExample.class, void.class, "<init>", int.class);
+        testFindSpecial(false, Example.class, void.class, "<init>", int.class);
+        testFindSpecial(false, Example.class, void.class, "bogus");
+    }
+
+    void testFindSpecial(Class<?> defc, Class<?> ret, String name, Class<?>... params) {
+        testFindSpecial(true, defc, ret, name, params);
+    }
+    void testFindSpecial(boolean positive, Class<?> defc, Class<?> ret, String name, Class<?>... params) {
+        MethodType type = MethodType.make(ret, params);
+        MethodHandle target = null;
+        RuntimeException noAccess = null;
+        try {
+            target = SubExample.findSpecial(defc, name, type);
+        } catch (NoAccessException ex) {
+            noAccess = ex;
+        }
+        System.out.println("findSpecial "+defc+"."+name+"/"+type+" => "+target
+                +(noAccess == null ? "" : " !! "+noAccess));
+        if (positive && noAccess != null)  throw noAccess;
+        assertEquals(positive, target != null);
+        if (!positive)  return; // negative test failed as expected
+        Class<?>[] paramsWithSelf = cat(array(Class[].class, (Class)defc), params);
+        MethodType typeWithSelf = MethodType.make(ret, paramsWithSelf);
+        assertEquals(typeWithSelf, target.type());
+        Object[] args = randomArgs(paramsWithSelf);
+        printCalled(target, name, args);
+        MethodHandles.invoke(target, args);
+        assertCalled(name, args);
+        System.out.print(':');
+    }
+
+    @Test
+    public void testBind() {
+        if (CAN_SKIP_WORKING)  return;
+        System.out.println("bind");
+        testBind(Example.class, void.class, "v0");
+        testBind(Example.class, void.class, "pkg_v0");
+        testBind(Example.class, void.class, "pri_v0");
+        testBind(Example.class, Object.class, "v1", Object.class);
+        testBind(Example.class, Object.class, "v2", Object.class, Object.class);
+        testBind(Example.class, Object.class, "v2", Object.class, int.class);
+        testBind(Example.class, Object.class, "v2", int.class, Object.class);
+        testBind(Example.class, Object.class, "v2", int.class, int.class);
+        testBind(false, Example.class, void.class, "bogus");
+        testBind(SubExample.class, void.class, "Sub/v0");
+        testBind(SubExample.class, void.class, "Sub/pkg_v0");
+        testBind(IntExample.Impl.class, void.class, "Int/v0");
+    }
+
+    void testBind(Class<?> defc, Class<?> ret, String name, Class<?>... params) {
+        testBind(true, defc, ret, name, params);
+    }
+    void testBind(boolean positive, Class<?> defc, Class<?> ret, String name, Class<?>... params) {
+        String methodName = name.substring(1 + name.indexOf('/'));  // foo/bar => foo
+        MethodType type = MethodType.make(ret, params);
+        Object receiver = randomArg(defc);
+        MethodHandle target = null;
+        RuntimeException noAccess = null;
+        try {
+            target = LOOKUP.bind(receiver, methodName, type);
+        } catch (NoAccessException ex) {
+            noAccess = ex;
+        }
+        System.out.println("bind "+receiver+"."+name+"/"+type+" => "+target
+                +(noAccess == null ? "" : " !! "+noAccess));
+        if (positive && noAccess != null)  throw noAccess;
+        assertEquals(positive, target != null);
+        if (!positive)  return; // negative test failed as expected
+        assertEquals(type, target.type());
+        Object[] args = randomArgs(params);
+        printCalled(target, name, args);
+        MethodHandles.invoke(target, args);
+        Object[] argsWithReceiver = cat(array(Object[].class, receiver), args);
+        assertCalled(name, argsWithReceiver);
+        System.out.print(':');
+    }
+
+    @Test
+    public void testUnreflect() {
+        if (CAN_SKIP_WORKING)  return;
+        System.out.println("unreflect");
+        testUnreflect(Example.class, true, void.class, "s0");
+        testUnreflect(Example.class, true, void.class, "pkg_s0");
+        testUnreflect(Example.class, true, void.class, "pri_s0");
+
+        testUnreflect(Example.class, true, Object.class, "s1", Object.class);
+        testUnreflect(Example.class, true, Object.class, "s2", int.class);
+        //testUnreflect(Example.class, true, Object.class, "s3", long.class);
+        //testUnreflect(Example.class, true, Object.class, "s4", int.class, int.class);
+        //testUnreflect(Example.class, true, Object.class, "s5", long.class, int.class);
+        //testUnreflect(Example.class, true, Object.class, "s6", int.class, long.class);
+
+        testUnreflect(Example.class, false, void.class, "v0");
+        testUnreflect(Example.class, false, void.class, "pkg_v0");
+        testUnreflect(Example.class, false, void.class, "pri_v0");
+        testUnreflect(Example.class, false, Object.class, "v1", Object.class);
+        testUnreflect(Example.class, false, Object.class, "v2", Object.class, Object.class);
+        testUnreflect(Example.class, false, Object.class, "v2", Object.class, int.class);
+        testUnreflect(Example.class, false, Object.class, "v2", int.class, Object.class);
+        testUnreflect(Example.class, false, Object.class, "v2", int.class, int.class);
+    }
+
+    void testUnreflect(Class<?> defc, boolean isStatic, Class<?> ret, String name, Class<?>... params) {
+        testUnreflect(true, defc, isStatic, ret, name, params);
+    }
+    void testUnreflect(boolean positive, Class<?> defc, boolean isStatic, Class<?> ret, String name, Class<?>... params) {
+        MethodType type = MethodType.make(ret, params);
+        Method rmethod = null;
+        MethodHandle target = null;
+        RuntimeException noAccess = null;
+        try {
+            rmethod = defc.getDeclaredMethod(name, params);
+        } catch (NoSuchMethodException ex) {
+            throw new NoAccessException(ex);
+        }
+        MemberName mname = new MemberName(rmethod);
+        assertEquals(isStatic, mname.isStatic());
+        try {
+            target = Example.unreflect(rmethod);
+        } catch (NoAccessException ex) {
+            noAccess = ex;
+        }
+        System.out.println("unreflect "+defc+"."+name+"/"+type+" => "+target
+                +(noAccess == null ? "" : " !! "+noAccess));
+        if (positive && noAccess != null)  throw noAccess;
+        assertEquals(positive, target != null);
+        if (!positive)  return; // negative test failed as expected
+        Class<?>[] paramsMaybeWithSelf = params;
+        if (!isStatic) {
+            paramsMaybeWithSelf = cat(array(Class[].class, (Class)defc), params);
+        }
+        MethodType typeMaybeWithSelf = MethodType.make(ret, paramsMaybeWithSelf);
+        assertEquals(typeMaybeWithSelf, target.type());
+        Object[] argsMaybeWithSelf = randomArgs(paramsMaybeWithSelf);
+        printCalled(target, name, argsMaybeWithSelf);
+        MethodHandles.invoke(target, argsMaybeWithSelf);
+        assertCalled(name, argsMaybeWithSelf);
+        System.out.print(':');
+    }
+
+    @Test @Ignore("unimplemented")
+    public void testUnreflectSpecial() {
+        System.out.println("unreflectSpecial");
+        Method m = null;
+        MethodHandle expResult = null;
+        MethodHandle result = LOOKUP.unreflectSpecial(m, Example.class);
+        assertEquals(expResult, result);
+        fail("The test case is a prototype.");
+    }
+
+    @Test @Ignore("unimplemented")
+    public void testUnreflectGetter() {
+        System.out.println("unreflectGetter");
+        Field f = null;
+        MethodHandle expResult = null;
+        MethodHandle result = LOOKUP.unreflectGetter(f);
+        assertEquals(expResult, result);
+        fail("The test case is a prototype.");
+    }
+
+    @Test @Ignore("unimplemented")
+    public void testUnreflectSetter() {
+        System.out.println("unreflectSetter");
+        Field f = null;
+        MethodHandle expResult = null;
+        MethodHandle result = LOOKUP.unreflectSetter(f);
+        assertEquals(expResult, result);
+        fail("The test case is a prototype.");
+    }
+
+    @Test @Ignore("unimplemented")
+    public void testArrayElementGetter() {
+        System.out.println("arrayElementGetter");
+        Class<?> arrayClass = null;
+        MethodHandle expResult = null;
+        MethodHandle result = MethodHandles.arrayElementGetter(arrayClass);
+        assertEquals(expResult, result);
+        fail("The test case is a prototype.");
+    }
+
+    @Test @Ignore("unimplemented")
+    public void testArrayElementSetter() {
+        System.out.println("arrayElementSetter");
+        Class<?> arrayClass = null;
+        MethodHandle expResult = null;
+        MethodHandle result = MethodHandles.arrayElementSetter(arrayClass);
+        assertEquals(expResult, result);
+        fail("The test case is a prototype.");
+    }
+
+    static class Callee {
+        static Object id() { return called("id"); }
+        static Object id(Object x) { return called("id", x); }
+        static Object id(Object x, Object y) { return called("id", x, y); }
+        static Object id(Object x, Object y, Object z) { return called("id", x, y, z); }
+        static Object id(Object... vx) { return called("id", vx); }
+        static MethodHandle ofType(int n) {
+            return ofType(Object.class, n);
+        }
+        static MethodHandle ofType(Class<?> rtype, int n) {
+            if (n == -1)
+                return ofType(MethodType.make(rtype, Object[].class));
+            return ofType(MethodType.makeGeneric(n).changeReturnType(rtype));
+        }
+        static MethodHandle ofType(Class<?> rtype, Class<?>... ptypes) {
+            return ofType(MethodType.make(rtype, ptypes));
+        }
+        static MethodHandle ofType(MethodType type) {
+            Class<?> rtype = type.returnType();
+            String pfx = "";
+            if (rtype != Object.class)
+                pfx = rtype.getSimpleName().substring(0, 1).toLowerCase();
+            String name = pfx+"id";
+            return LOOKUP.findStatic(Callee.class, name, type);
+        }
+    }
+
+    @Test
+    public void testConvertArguments_pairwise() {
+        if (CAN_SKIP_WORKING)  return;
+        System.out.println("convertArguments/pairwise");
+        testConvert(Callee.ofType(1), null, "id", String.class);
+        testConvert(Callee.ofType(1), null, "id", Integer.class);
+        testConvert(Callee.ofType(1), null, "id", int.class);
+        testConvert(Callee.ofType(1), null, "id", short.class);
+    }
+
+    void testConvert(MethodHandle id, Class<?> rtype, String name, Class<?>... params) {
+        testConvert(true, id, rtype, name, params);
+    }
+
+    void testConvert(boolean positive, MethodHandle id, Class<?> rtype, String name, Class<?>... params) {
+        MethodType idType = id.type();
+        if (rtype == null)  rtype = idType.returnType();
+        for (int i = 0; i < params.length; i++) {
+            if (params[i] == null)  params[i] = idType.parameterType(i);
+        }
+        // simulate the pairwise conversion
+        MethodType newType = MethodType.make(rtype, params);
+        Object[] args = randomArgs(newType.parameterArray());
+        Object[] convArgs = args.clone();
+        for (int i = 0; i < args.length; i++) {
+            Class<?> src = newType.parameterType(i);
+            Class<?> dst = idType.parameterType(i);
+            if (src != dst)
+                convArgs[i] = Wrapper.forPrimitiveType(dst).cast(convArgs[i], dst);
+        }
+        Object convResult = MethodHandles.invoke(id, convArgs);
+        {
+            Class<?> dst = newType.returnType();
+            Class<?> src = idType.returnType();
+            if (src != dst)
+                convResult = Wrapper.forPrimitiveType(dst).cast(convResult, dst);
+        }
+        MethodHandle target = null;
+        RuntimeException error = null;
+        try {
+            target = MethodHandles.convertArguments(id, newType);
+        } catch (RuntimeException ex) {
+            error = ex;
+        }
+        System.out.println("convert "+id+ " to "+newType+" => "+target
+                +(error == null ? "" : " !! "+error));
+        if (positive && error != null)  throw error;
+        assertEquals(positive, target != null);
+        if (!positive)  return; // negative test failed as expected
+        assertEquals(newType, target.type());
+        printCalled(target, id.toString(), args);
+        Object result = MethodHandles.invoke(target, args);
+        assertCalled(name, convArgs);
+        assertEquals(convResult, result);
+        System.out.print(':');
+    }
+
+    @Test @Ignore("unimplemented")
+    public void testSpreadArguments() {
+        System.out.println("spreadArguments");
+        MethodHandle target = null;
+        MethodType newType = null;
+        MethodHandle expResult = null;
+        MethodHandle result = MethodHandles.spreadArguments(target, newType);
+        assertEquals(expResult, result);
+        fail("The test case is a prototype.");
+    }
+
+    @Test @Ignore("unimplemented")
+    public void testCollectArguments() {
+        System.out.println("collectArguments");
+        MethodHandle target = null;
+        MethodType newType = null;
+        MethodHandle expResult = null;
+        MethodHandle result = MethodHandles.collectArguments(target, newType);
+        assertEquals(expResult, result);
+        fail("The test case is a prototype.");
+    }
+
+    @Test @Ignore("unimplemented")
+    public void testInsertArgument_MethodHandle_Object() {
+        System.out.println("insertArgument");
+        MethodHandle target = null;
+        Object value = null;
+        MethodHandle expResult = null;
+        MethodHandle result = MethodHandles.insertArgument(target, 0, value);
+        assertEquals(expResult, result);
+        fail("The test case is a prototype.");
+    }
+
+    @Test @Ignore("unimplemented")
+    public void testAppendArgument() {
+        System.out.println("appendArgument");
+        MethodHandle target = null;
+        Object value = null;
+        MethodHandle expResult = null;
+        MethodHandle result = MethodHandles.insertArgument(target, target.type().parameterCount(), value);
+        assertEquals(expResult, result);
+        fail("The test case is a prototype.");
+    }
+
+    @Test @Ignore("unimplemented")
+    public void testInsertArgument_3args() {
+        System.out.println("insertArgument");
+        MethodHandle target = null;
+        Object value = null;
+        int pos = 0;
+        MethodHandle expResult = null;
+        MethodHandle result = MethodHandles.insertArgument(target, pos, value);
+        assertEquals(expResult, result);
+        fail("The test case is a prototype.");
+    }
+
+    @Test @Ignore("unimplemented")
+    public void testDropArguments() {
+        System.out.println("dropArguments");
+        MethodHandle target = null;
+        int pos = 0;
+        Class<?>[] valueTypes = null;
+        MethodHandle expResult = null;
+        MethodHandle result = MethodHandles.dropArguments(target, pos, valueTypes);
+        assertEquals(expResult, result);
+        fail("The test case is a prototype.");
+    }
+
+    @Test @Ignore("unimplemented")
+    public void testGuardWithTest() {
+        System.out.println("guardWithTest");
+        MethodHandle test = null;
+        MethodHandle target = null;
+        MethodHandle fallback = null;
+        MethodHandle expResult = null;
+        MethodHandle result = MethodHandles.guardWithTest(test, target, fallback);
+        assertEquals(expResult, result);
+        fail("The test case is a prototype.");
+    }
+
+    @Test @Ignore("unimplemented")
+    public void testCombineArguments() {
+        System.out.println("checkArguments");
+        MethodHandle target = null;
+        MethodHandle checker = null;
+        int pos = 0;
+        MethodHandle expResult = null;
+        MethodHandle result = MethodHandles.combineArguments(target, pos, checker);
+        assertEquals(expResult, result);
+        fail("The test case is a prototype.");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netbeans/meth/test/jdk/java/dyn/MethodTypeTest.java	Fri May 08 14:24:28 2009 -0700
@@ -0,0 +1,402 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package jdk.java.dyn;
+
+import sun.dyn.MemberName;
+import java.dyn.MethodType;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.*;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author jrose
+ */
+public class MethodTypeTest {
+
+    private Class<?> rtype;
+    private Class<?>[] ptypes;
+    private MethodType mt_viS, mt_OO2, mt_vv, mt_Vv, mt_Ov;
+    private MethodType mt_iSI, mt_ISi, mt_ISI, mt_iSi;
+    private MethodType mt_viO, mt_iO2, mt_OOi, mt_iOi;
+    private MethodType mt_VIO, mt_IO2, mt_OOI, mt_IOI, mt_VIS;
+    private Method compareTo;
+
+    @Before
+    public void setUp() throws Exception {
+        rtype = void.class;
+        ptypes = new Class<?>[] { int.class, String.class };
+
+        mt_viS = MethodType.make(void.class, int.class, String.class);
+        mt_OO2 = MethodType.make(Object.class, Object.class, Object.class);
+        mt_vv = MethodType.make(void.class);
+        mt_Vv = MethodType.make(Void.class);
+        mt_Ov = MethodType.make(Object.class);
+        mt_iSI = MethodType.make(int.class, String.class, Integer.class);
+        mt_ISi = MethodType.make(Integer.class, String.class, int.class);
+        mt_ISI = MethodType.make(Integer.class, String.class, Integer.class);
+        mt_iSi = MethodType.make(int.class, String.class, int.class);
+
+        compareTo = String.class.getDeclaredMethod("compareTo", String.class);
+
+        mt_viO = MethodType.make(void.class, int.class, Object.class);
+        mt_iO2 = MethodType.make(int.class, Object.class, Object.class);
+        mt_OOi = MethodType.make(Object.class, Object.class, int.class);
+        mt_iOi = MethodType.make(int.class, Object.class, int.class);
+
+        mt_VIO = MethodType.make(Void.class, Integer.class, Object.class);
+        mt_IO2 = MethodType.make(Integer.class, Object.class, Object.class);
+        mt_OOI = MethodType.make(Object.class, Object.class, Integer.class);
+        mt_IOI = MethodType.make(Integer.class, Object.class, Integer.class);
+        mt_VIS = MethodType.make(Void.class, Integer.class, String.class);
+
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    /**
+     * Test of make method, of class MethodType.
+     */
+    @Test
+    public void testMake_Class_ClassArr() {
+        System.out.println("make (from type array)");
+        MethodType result = MethodType.make(rtype, ptypes);
+        assertEquals(mt_viS, result);
+    }
+
+    /**
+     * Test of make method, of class MethodType.
+     */
+    @Test
+    public void testMake_Class_List() {
+        System.out.println("make (from type list)");
+        MethodType result = MethodType.make(rtype, Arrays.asList(ptypes));
+        assertEquals(mt_viS, result);
+    }
+
+    /**
+     * Test of make method, of class MethodType.
+     */
+    @Test
+    public void testMake_3args() {
+        System.out.println("make (from type with varargs)");
+        MethodType result = MethodType.make(rtype, ptypes[0], ptypes[1]);
+        assertEquals(mt_viS, result);
+    }
+
+    /**
+     * Test of make method, of class MethodType.
+     */
+    @Test
+    public void testMake_Class() {
+        System.out.println("make (from single type)");
+        Class<?> rt = Integer.class;
+        MethodType expResult = MethodType.make(rt, new Class<?>[0]);
+        MethodType result = MethodType.make(rt);
+        assertEquals(expResult, result);
+    }
+
+    @Test
+    public void testMakeGeneric() {
+        System.out.println("makeGeneric");
+        int objectArgCount = 2;
+        MethodType expResult = mt_OO2;
+        MethodType result = MethodType.makeGeneric(objectArgCount);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of make method, of class MethodType.
+     */
+    @Test
+    public void testMake_Method() {
+        System.out.println("make (via MemberName.getMethodType)");
+        MethodType expResult = MethodType.make(int.class, String.class);
+        MemberName name = new MemberName(compareTo);
+        MethodType result = name.getMethodType();
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of make method, of class MethodType.
+     */
+    @Test
+    public void testMake_MethodType() {
+        System.out.println("make (from rtype, MethodType)");
+        MethodType expResult = mt_iO2;
+        MethodType result = MethodType.make(int.class, mt_IO2);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of make method, of class MethodType.
+     */
+    @Test
+    public void testMake_String_ClassLoader() {
+        System.out.println("make (from bytecode signature)");
+        ClassLoader loader = null;
+        MethodType[] instances = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
+        String obj = "Ljava/lang/Object;";
+        assertEquals(obj, concat(Object.class));
+        String[] expResults = {
+            "(ILjava/lang/String;)V",
+            concat("(", obj, 2, ")", Object.class),
+            "()V", "()"+obj,
+            concat("(", String.class, Integer.class, ")I"),
+            concat("(", String.class, "I)", Integer.class),
+            concat("(", String.class, Integer.class, ")", Integer.class),
+            concat("(", String.class, "I)I")
+        };
+        for (int i = 0; i < instances.length; i++) {
+            MethodType instance = instances[i];
+            String result = instance.toBytecodeString();
+            assertEquals("#"+i, expResults[i], result);
+            MethodType parsed = MethodType.fromBytecodeString(result, loader);
+            assertEquals("--#"+i, instance, parsed);
+        }
+    }
+    private static String concat(Object... parts) {
+        StringBuilder sb = new StringBuilder();
+        Object prevPart = "";
+        for (Object part : parts) {
+            if (part instanceof Class) {
+                part = "L"+((Class)part).getName()+";";
+            }
+            if (part instanceof Integer) {
+                for (int n = (Integer) part; n > 1; n--)
+                    sb.append(prevPart);
+                part = "";
+            }
+            sb.append(part);
+            prevPart = part;
+        }
+        return sb.toString().replace('.', '/');
+    }
+
+    @Test
+    public void testHasPrimitives() {
+        System.out.println("hasPrimitives");
+        MethodType[] instances = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
+        boolean[] expResults =   {true,   false,  true,  false, true,   true,   false,  true};
+        for (int i = 0; i < instances.length; i++) {
+            boolean result = instances[i].hasPrimitives();
+            assertEquals("#"+i, expResults[i], result);
+        }
+    }
+
+    @Test
+    public void testHasWrappers() {
+        System.out.println("hasWrappers");
+        MethodType[] instances = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
+        boolean[] expResults =   {false,  false,  false, false, true,   true,   true,   false};
+        for (int i = 0; i < instances.length; i++) {
+            System.out.println("  hasWrappers "+instances[i]);
+            boolean result = instances[i].hasWrappers();
+            assertEquals("#"+i, expResults[i], result);
+        }
+    }
+
+    @Test
+    public void testErase() {
+        System.out.println("erase");
+        MethodType[] instances  = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
+        MethodType[] expResults = {mt_viO, mt_OO2, mt_vv, mt_Ov, mt_iO2, mt_OOi, mt_OO2, mt_iOi};
+        for (int i = 0; i < instances.length; i++) {
+            MethodType result = instances[i].erase();
+            assertEquals("#"+i, expResults[i], result);
+        }
+    }
+
+    @Test
+    public void testGeneric() {
+        System.out.println("generic");
+        MethodType[] instances =  {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
+        MethodType[] expResults = {mt_OO2, mt_OO2, mt_Ov, mt_Ov, mt_OO2, mt_OO2, mt_OO2, mt_OO2};
+        for (int i = 0; i < instances.length; i++) {
+            MethodType result = instances[i].generic();
+            assertEquals("#"+i, expResults[i], result);
+        }
+    }
+
+    @Test
+    public void testWrap() {
+        System.out.println("wrap");
+        MethodType[] instances =  {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
+        MethodType[] expResults = {mt_VIS, mt_OO2, mt_Vv, mt_Ov, mt_ISI, mt_ISI, mt_ISI, mt_ISI};
+        for (int i = 0; i < instances.length; i++) {
+            MethodType result = instances[i].wrap();
+            assertEquals("#"+i, expResults[i], result);
+        }
+    }
+
+    @Test
+    public void testUnwrap() {
+        System.out.println("unwrap");
+        MethodType[] instances =  {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
+        MethodType[] expResults = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSi, mt_iSi, mt_iSi, mt_iSi};
+        for (int i = 0; i < instances.length; i++) {
+            MethodType result = instances[i].unwrap();
+            assertEquals("#"+i, expResults[i], result);
+        }
+    }
+
+    /**
+     * Test of parameterType method, of class MethodType.
+     */
+    @Test
+    public void testParameterType() {
+        System.out.println("parameterType");
+        for (int num = 0; num < ptypes.length; num++) {
+            MethodType instance = mt_viS;
+            Class<?> expResult = ptypes[num];
+            Class<?> result = instance.parameterType(num);
+            assertEquals(expResult, result);
+        }
+    }
+
+    /**
+     * Test of parameterCount method, of class MethodType.
+     */
+    @Test
+    public void testParameterCount() {
+        System.out.println("parameterCount");
+        MethodType instance = mt_viS;
+        int expResult = 2;
+        int result = instance.parameterCount();
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of returnType method, of class MethodType.
+     */
+    @Test
+    public void testReturnType() {
+        System.out.println("returnType");
+        MethodType instance = mt_viS;
+        Class<?> expResult = void.class;
+        Class<?> result = instance.returnType();
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of parameterList method, of class MethodType.
+     */
+    @Test
+    public void testParameterList() {
+        System.out.println("parameterList");
+        MethodType instance = mt_viS;
+        List<Class<?>> expResult = Arrays.asList(ptypes);
+        List<Class<?>> result = instance.parameterList();
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of parameterArray method, of class MethodType.
+     */
+    @Test
+    public void testParameterArray() {
+        System.out.println("parameterArray");
+        MethodType instance = mt_viS;
+        Class<?>[] expResult = ptypes;
+        Class<?>[] result = instance.parameterArray();
+        assertEquals(Arrays.asList(expResult), Arrays.asList(result));
+    }
+
+    /**
+     * Test of equals method, of class MethodType.
+     */
+    @Test
+    public void testEquals_Object() {
+        System.out.println("equals");
+        Object x = null;
+        MethodType instance = mt_viS;
+        boolean expResult = false;
+        boolean result = instance.equals(x);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of equals method, of class MethodType.
+     */
+    @Test
+    public void testEquals_MethodType() {
+        System.out.println("equals");
+        MethodType that = mt_viS;
+        MethodType instance = mt_viS;
+        boolean expResult = true;
+        boolean result = instance.equals(that);
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of hashCode method, of class MethodType.
+     */
+    @Test
+    public void testHashCode() {
+        System.out.println("hashCode");
+        MethodType instance = mt_viS;
+        ArrayList<Class<?>> types = new ArrayList<Class<?>>();
+        types.add(instance.returnType());
+        types.addAll(instance.parameterList());
+        int expResult = types.hashCode();
+        int result = instance.hashCode();
+        assertEquals(expResult, result);
+    }
+
+    /**
+     * Test of toString method, of class MethodType.
+     */
+    @Test
+    public void testToString() {
+        System.out.println("toString");
+        MethodType[] instances = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi};
+        //String expResult = "void[int, class java.lang.String]";
+        String[] expResults = {
+            "(int,java.lang.String)void",
+            "(java.lang.Object,java.lang.Object)java.lang.Object",
+            "()void",
+            "()java.lang.Object",
+            "(java.lang.String,java.lang.Integer)int",
+            "(java.lang.String,int)java.lang.Integer",
+            "(java.lang.String,java.lang.Integer)java.lang.Integer",
+            "(java.lang.String,int)int"
+        };
+        for (int i = 0; i < instances.length; i++) {
+            MethodType instance = instances[i];
+            String result = instance.toString();
+            System.out.println("#"+i+":"+result);
+            assertEquals("#"+i, expResults[i], result);
+        }
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netbeans/meth/test/jdk/java/dyn/util/WrapperTest.java	Fri May 08 14:24:28 2009 -0700
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package jdk.java.dyn.util;
+
+import org.junit.Test;
+import sun.dyn.util.Wrapper;
+import static sun.dyn.util.Wrapper.*;
+
+/**
+ *
+ * @author jrose
+ */
+public class WrapperTest {
+    static void assertLocal(boolean z) {
+        if (!z)  throw new InternalError();
+    }
+
+    @Test public void test() { test(true); }
+
+    static boolean test(boolean verbose) {
+        Class<Integer> PTYPE = int.class, WTYPE = Integer.class;
+        assertLocal(PTYPE != WTYPE);
+        assertLocal(forPrimitiveType(PTYPE) == INT);
+        assertLocal(forWrapperType(WTYPE) == INT);
+        assertLocal(asPrimitiveType(PTYPE) == PTYPE);
+        assertLocal(asPrimitiveType(WTYPE) == PTYPE);
+        assertLocal(  asWrapperType(PTYPE) == WTYPE);
+        assertLocal(  asWrapperType(WTYPE) == WTYPE);
+
+        assertLocal(forWrapperType(Object.class) == OBJECT);
+        assertLocal(forWrapperType(Iterable.class) == OBJECT);
+        assertLocal(forWrapperType(Void.class) == VOID);
+        assertLocal(forWrapperType(Integer.class) == INT);
+        assertLocal(forPrimitiveType(void.class) == VOID);
+        assertLocal(forPrimitiveType(int.class).bitWidth() == 32);
+        assertLocal(forPrimitiveType(char.class) == CHAR);
+        assertLocal(forPrimitiveType(char.class).bitWidth() == 16);
+        assertLocal(forPrimitiveType(short.class).bitWidth() == 16);
+        assertLocal(forPrimitiveType(byte.class).bitWidth() == 8);
+        assertLocal(forPrimitiveType(boolean.class).bitWidth() == 1);
+        assertLocal(forPrimitiveType(double.class).bitWidth() == 64);
+        assertLocal(forPrimitiveType(float.class).bitWidth() == 32);
+
+        Wrapper[] wrappers = { BYTE, SHORT, INT, LONG, BOOLEAN, CHAR, FLOAT, DOUBLE, VOID, OBJECT };
+        assertLocal(values().length == wrappers.length);
+        String chars = "BSIJ"          + "ZCFD"          + "VL";
+        String bitws = "\10\20\40\100" + "\01\20\40\100" + "\0\0";
+        String kinds = "\1\1\1\1"      + "\2\2\4\4"      + "\0\0";
+        String slots = "\1\1\1\2"      + "\1\1\1\2"      + "\0\1";
+        for (int i = 0; i < wrappers.length; i++) {
+            Wrapper w = wrappers[i];
+            if (verbose)  System.out.println("testing "+w);
+            assertLocal(forPrimitiveType(w.primitiveType()) == w);
+            assertLocal(forWrapperType(w.wrapperType()) == w);
+            assertLocal(w.basicTypeChar() == chars.charAt(i));
+            assertLocal(w.bitWidth() == bitws.charAt(i));
+            int wkind = (w.isSigned() ? 1 : 0) | (w.isUnsigned() ? 2 : 0) | (w.isFloating() ? 4 : 0);
+            assertLocal(wkind == kinds.charAt(i));
+            assertLocal(w.stackSlots() == slots.charAt(i));
+            assertLocal(w.isNumeric()  == ((wkind & 7) != 0));
+            assertLocal(w.isIntegral() == ((wkind & 3) != 0));
+            assertLocal(w.isSubwordOrInt() == (w.isIntegral() && w.bitWidth() <= 32));
+        }
+        return true;
+    }
+    public static void main(String... av) {
+        test(true);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netbeans/meth/test/sun/dyn/util/ValueConversionsTest.java	Fri May 08 14:24:28 2009 -0700
@@ -0,0 +1,235 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Sun Microsystems, Inc., 4110 Network Circle, Santa Clara,
+ * CA 91054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.dyn.util;
+
+import java.dyn.MethodHandle;
+import java.io.Serializable;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author jrose
+ */
+public class ValueConversionsTest {
+
+    @Test
+    public void testUnbox() {
+        System.out.println("unbox");
+        for (Wrapper w : Wrapper.values()) {
+            System.out.println(w);
+            boolean exact = (w == Wrapper.SHORT);  // spot-check exact typing version
+            for (int n = -5; n < 10; n++) {
+                Object box = w.wrap(n);
+                switch (w) {
+                    case VOID:   assertEquals(box, null); break;
+                    case OBJECT: assertEquals(box.getClass(), Integer.class); break;
+                    default:     assertEquals(box.getClass(), w.wrapperType()); break;
+                }
+                MethodHandle unboxer = ValueConversions.unbox(w.primitiveType(), exact);
+                Object expResult = box;
+                Object result = null;
+                switch (w) {
+                    case INT:     result = unboxer.<int   >invoke(box); break;
+                    case LONG:    result = unboxer.<long  >invoke(box); break;
+                    case FLOAT:   result = unboxer.<float >invoke(box); break;
+                    case DOUBLE:  result = unboxer.<double>invoke(box); break;
+                    case CHAR:    result = unboxer.<char  >invoke(box); break;
+                    case BYTE:    result = unboxer.<byte  >invoke(box); break;
+                    case SHORT:   result = unboxer.<short >invoke((Short)box); break;
+                    case OBJECT:  result = unboxer.<Object>invoke(box); break;
+                    case BOOLEAN: result = unboxer.<boolean>invoke(box); break;
+                    case VOID:    result = null; unboxer.<void>invoke(box); break;
+                }
+                assertEquals("w="+w+" n="+n+" box="+box, expResult, result);
+            }
+        }
+    }
+
+    @Test
+    public void testUnboxRaw() {
+        System.out.println("unboxRaw");
+        for (Wrapper w : Wrapper.values()) {
+            if (w == Wrapper.OBJECT)  continue;  // skip this; no raw form
+            boolean exact = (w == Wrapper.SHORT);  // spot-check exact typing version
+            System.out.println(w);
+            for (int n = -5; n < 10; n++) {
+                Object box = w.wrap(n);
+                long expResult = w.unwrapRaw(box);
+                Object box2 = w.wrapRaw(expResult);
+                assertEquals(box, box2);
+                MethodHandle unboxer = ValueConversions.unboxRaw(w.primitiveType(), exact);
+                long result = -1;
+                switch (w) {
+                    case INT:     result = unboxer.<int   >invoke(box); break;
+                    case LONG:    result = unboxer.<long  >invoke(box); break;
+                    case FLOAT:   result = unboxer.<int   >invoke(box); break;
+                    case DOUBLE:  result = unboxer.<long  >invoke(box); break;
+                    case CHAR:    result = unboxer.<int   >invoke(box); break;
+                    case BYTE:    result = unboxer.<int   >invoke(box); break;
+                    case SHORT:   result = unboxer.<int   >invoke((Short)box); break;
+                    case BOOLEAN: result = unboxer.<int   >invoke(box); break;
+                    case VOID:    result = unboxer.<int   >invoke(box); break;
+                }
+                assertEquals("w="+w+" n="+n+" box="+box, expResult, result);
+            }
+        }
+    }
+
+    @Test
+    public void testBox() {
+        System.out.println("box");
+        for (Wrapper w : Wrapper.values()) {
+            if (w == Wrapper.VOID)  continue;  // skip this; no unboxed form
+            boolean exact = (w != Wrapper.SHORT);  // spot-check exact typing version
+            System.out.println(w);
+            for (int n = -5; n < 10; n++) {
+                Object box = w.wrap(n);
+                MethodHandle boxer = ValueConversions.box(w.primitiveType(), exact);
+                Object expResult = box;
+                Object result = null;
+                switch (w) {
+                    case INT:     result = boxer.<Integer>invoke((int)n); break;
+                    case LONG:    result = boxer.<Long   >invoke((long)n); break;
+                    case FLOAT:   result = boxer.<Float  >invoke((float)n); break;
+                    case DOUBLE:  result = boxer.<Double >invoke((double)n); break;
+                    case CHAR:    result = boxer.<Character>invoke((char)n); break;
+                    case BYTE:    result = boxer.<Byte   >invoke((byte)n); break;
+                    case SHORT:   result = boxer.<Object>invoke((short)n); break;
+                    case OBJECT:  result = boxer.<Object>invoke((Object)n); break;
+                    case BOOLEAN: result = boxer.<Boolean>invoke(n != 0); break;
+                }
+                assertEquals("w="+w+" n="+n+" box="+box, expResult, result);
+            }
+        }
+    }
+
+    @Test
+    public void testBoxRaw() {
+        System.out.println("boxRaw");
+        for (Wrapper w : Wrapper.values()) {
+            if (w == Wrapper.VOID)  continue;  // skip this; no unboxed form
+            if (w == Wrapper.OBJECT)  continue;  // skip this; no raw form
+            boolean exact = (w != Wrapper.SHORT);  // spot-check exact typing version
+            System.out.println(w);
+            for (int n = -5; n < 10; n++) {
+                Object box = w.wrap(n);
+                long   raw = w.unwrapRaw(box);
+                Object expResult = box;
+                MethodHandle boxer = ValueConversions.boxRaw(w.primitiveType(), exact);
+                Object result = null;
+                switch (w) {
+                    case INT:     result = boxer.<Integer>invoke((int)raw); break;
+                    case LONG:    result = boxer.<Long   >invoke(raw); break;
+                    case FLOAT:   result = boxer.<Float  >invoke((int)raw); break;
+                    case DOUBLE:  result = boxer.<Double >invoke(raw); break;
+                    case CHAR:    result = boxer.<Character>invoke((int)raw); break;
+                    case BYTE:    result = boxer.<Byte   >invoke((int)raw); break;
+                    case SHORT:   result = boxer.<Object >invoke((int)raw); break;
+                    case BOOLEAN: result = boxer.<Boolean>invoke((int)raw); break;
+                }
+                assertEquals("w="+w+" n="+n+" box="+box, expResult, result);
+            }
+        }
+    }
+
+    @Test
+    public void testReboxRaw() {
+        System.out.println("reboxRaw");
+        for (Wrapper w : Wrapper.values()) {
+            Wrapper pw = Wrapper.forPrimitiveType(w.rawPrimitiveType());
+            if (w == Wrapper.VOID)  continue;  // skip this; no unboxed form
+            if (w == Wrapper.OBJECT)  continue;  // skip this; no raw form
+            boolean exact = (w != Wrapper.SHORT);  // spot-check exact typing version
+            System.out.println(w);
+            for (int n = -5; n < 10; n++) {
+                Object box = w.wrap(n);
+                Object raw = pw.wrap(w.unwrapRaw(box));
+                Object expResult = box;
+                MethodHandle boxer = ValueConversions.rebox(w.primitiveType(), exact);
+                Object result = null;
+                switch (w) {
+                    case INT:     result = boxer.<Integer>invoke(raw); break;
+                    case LONG:    result = boxer.<Long   >invoke(raw); break;
+                    case FLOAT:   result = boxer.<Float  >invoke(raw); break;
+                    case DOUBLE:  result = boxer.<Double >invoke(raw); break;
+                    case CHAR:    result = boxer.<Character>invoke(raw); break;
+                    case BYTE:    result = boxer.<Byte   >invoke(raw); break;
+                    case SHORT:   result = boxer.<Object >invoke(raw); break;
+                    case BOOLEAN: result = boxer.<Boolean>invoke(raw); break;
+                }
+                assertEquals("w="+w+" n="+n+" box="+box, expResult, result);
+            }
+        }
+    }
+
+    @Test
+    public void testCast() {
+        System.out.println("cast");
+        Class<?>[] types = { Object.class, Serializable.class, String.class, Number.class, Integer.class };
+        Object[] objects = { new Object(), Boolean.FALSE,      "hello",      (Long)12L,    (Integer)6    };
+        for (Class<?> dst : types) {
+            boolean exactInt = (dst == Integer.class);
+            MethodHandle caster = ValueConversions.cast(dst, exactInt);
+            for (Object obj : objects) {
+                Class<?> src = obj.getClass();
+                boolean canCast;
+                if (dst.isInterface()) {
+                    canCast = true;
+                } else {
+                    canCast = dst.isAssignableFrom(src);
+                    assertEquals(canCast, dst.isInstance(obj));
+                }
+                //System.out.println("obj="+obj+" <: dst="+dst);
+                try {
+                    Object result;
+                    if (!exactInt)
+                        result = caster.<Object>invoke(obj);
+                    else
+                        result = caster.<Integer>invoke(obj);
+                    if (canCast)
+                        assertEquals(obj, result);
+                    else
+                        assertEquals("cast should not have succeeded", dst, obj);
+                } catch (ClassCastException ex) {
+                    if (canCast)
+                        throw ex;
+                }
+            }
+        }
+    }
+
+    @Test
+    public void testIdentity() {
+        System.out.println("identity");
+        MethodHandle id = ValueConversions.identity();
+        Object expResult = "foo";
+        Object result = id.<Object>invoke(expResult);
+        // compiler bug:  ValueConversions.identity().<Object>invoke("bar");
+        assertEquals(expResult, result);
+    }
+
+}
\ No newline at end of file