changeset 54:eb512c59ff51

meth: 7012648: move JSR 292 to package java.lang.invoke and adjust names
author jrose
date Mon, 04 Apr 2011 15:23:43 -0700
parents 0b7c3ce7100f
children bca37faeae55
files netbeans/indy-demo/nbproject/project.properties netbeans/meth/build.xml netbeans/meth/nbproject/project.properties netbeans/meth/test/sun/dyn/util/BytecodeNameTest.java netbeans/meth/test/sun/dyn/util/ValueConversionsTest.java netbeans/meth/test/sun/dyn/util/WrapperTest.java netbeans/meth/test/sun/invoke/util/BytecodeNameTest.java netbeans/meth/test/sun/invoke/util/ValueConversionsTest.java netbeans/meth/test/sun/invoke/util/WrapperTest.java
diffstat 9 files changed, 745 insertions(+), 740 deletions(-) [+]
line wrap: on
line diff
--- a/netbeans/indy-demo/nbproject/project.properties	Mon Apr 04 15:23:19 2011 -0700
+++ b/netbeans/indy-demo/nbproject/project.properties	Mon Apr 04 15:23:43 2011 -0700
@@ -28,8 +28,8 @@
     ${reference.meth.jar}
 # Space-separated list of extra javac options
 javac.compilerargs=-XDinvokedynamic -Xlint:none -XDallowTransitionalJSR292=${allowTransitionalJSR292} ${javac.standalone.bcp} ${meth.standalone.bcp}
-meth.standalone.bcp =
-#meth.standalone.bcp = -Xbootclasspath/p:${reference.meth.jar}
+#meth.standalone.bcp =
+meth.standalone.bcp = -Xbootclasspath/p:${reference.meth.jar}
 # choices: yes, no
 allowTransitionalJSR292=no
 # assuming full JDK_7X:
@@ -71,7 +71,8 @@
 # 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=-ea -esa -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic ${meth.standalone.bcp}
+run.jvmargs=-ea -esa -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic ${meth.extra.jvmargs} ${meth.standalone.bcp}
+meth.extra.jvmargs = -XX:-AllowTransitionalJSR292 -XX:+AllowInvokeForInvokeGeneric
 run.test.classpath=\
     ${javac.test.classpath}:\
     ${build.test.classes.dir}
--- a/netbeans/meth/build.xml	Mon Apr 04 15:23:19 2011 -0700
+++ b/netbeans/meth/build.xml	Mon Apr 04 15:23:43 2011 -0700
@@ -11,25 +11,27 @@
     <import file="nbproject/build-impl.xml"/>
 
     <target name="-pre-compile">
-        <echo>Relevant attributes and properties to javac:
-    srcdir:         ${src.dir}
-    destdir:        ${build.classes.dir}
-    compilerarg:    ${javac.compilerargs}
-    compilerarg:    ${endorsed.classpath.cmd.line.arg}
-    classpath:      ${javac.classpath}
-    includes:       ${includes}
-    excludes:       ${excludes}
+        <echo>Relevant attributes and properties:
+    srcdir=         ${src.dir}
+    destdir=        ${build.classes.dir}
+    compilerarg=    ${javac.compilerargs}
+    compilerarg=    ${endorsed.classpath.cmd.line.arg}
+    classpath=      ${javac.classpath}
+    includes=       ${includes}
+    excludes=       ${excludes}
     debug=          ${javac.debug}
-    sourcepath:     ${empty.dir}
-    gensrcdir:      ${empty.dir}
+    sourcepath=     ${empty.dir}
+    gensrcdir=      ${empty.dir}
     deprecation=    ${javac.deprecation}
     encoding=       ${source.encoding}
     executable=     ${platform.javac}
     source=         ${javac.source}
     target=         ${javac.target}
     tempdir=        ${java.io.tmpdir}
-    other attrs:    fork=yes includeantruntime=false
-    java.home=      ${java.home}
+    other attrs=    fork=yes includeantruntime=false
+    platform.java=  ${platform.java}
+    run.jvmargs=    ${run.jvmargs}
+    run.test.cp=    ${run.test.classpath}
         </echo>
     </target>
 
@@ -48,7 +50,7 @@
         </copy>
     </target>
 
-    <property name="javadoc.includes" value="java/dyn/*.java"/>
+    <property name="javadoc.includes" value="java/dyn/*.java,java/lang/invoke/*.java,java/lang/ClassValue.java,java/lang/BootstrapMethodError.java"/>
 
     <target depends="init" name="-javadoc-build">
         <mkdir dir="${dist.javadoc.dir}"/>
--- a/netbeans/meth/nbproject/project.properties	Mon Apr 04 15:23:19 2011 -0700
+++ b/netbeans/meth/nbproject/project.properties	Mon Apr 04 15:23:43 2011 -0700
@@ -52,7 +52,7 @@
 #file.reference.bsd-i586-classes=../davinci/sources/build/bsd-i586/classes
 file.reference.test-classes=build/test/classes
 file.reference.jdk-tests=${file.reference.davinci-project-folder.sources.jdk}/test
-includes=java/dyn/**/*.java,jdk/java/dyn/**/*.java,sun/dyn/**/*.java,test/java/dyn/**/*.java
+includes=java/dyn/**/*.java,sun/dyn/**/*.java,test/java/dyn/**/*.java,java/lang/invoke/**/*.java,sun/invoke/**/*.java,test/java/lang/invoke/**/*.java,java/lang/BootstrapMethodError.java,java/lang/ClassValue.java,java/lang/IllegalAccessException.java,java/lang/NoSuchMethodException.java,java/lang/NoSuchFieldException.java
 #includes=**
 jar.compress=true
 javac.classpath=
@@ -104,9 +104,11 @@
 # 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=-XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic -ea -esa ${config.run.jvmargs} -Xbootclasspath/p:"${run.classpath}:${libs.junit_4.classpath}" -Dbuild.test.classes.dir=${build.test.classes.dir}
+run.jvmargs=-XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic -ea -esa ${config.run.jvmargs} ${meth.extra.jvmargs} -Xbootclasspath/p:"${run.classpath}:${libs.junit_4.classpath}" -Dbuild.test.classes.dir=${build.test.classes.dir}
 #manual hack: override ${config.run.jvmargs} in ${config}.properties
-config.run.jvmargs=-XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles
+config.run.jvmargs =
+meth.extra.jvmargs = -XX:-AllowTransitionalJSR292 -XX:+AllowInvokeForInvokeGeneric
+#meth.extra.jvmargs = -XX:+PreferTransitionalJSR292
 run.test.classpath=\
     ${javac.test.classpath}:\
     ${build.test.classes.dir}
--- a/netbeans/meth/test/sun/dyn/util/BytecodeNameTest.java	Mon Apr 04 15:23:19 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,369 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.dyn.util;
-
-import java.util.Arrays;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-/**
- *
- * @author jrose
- */
-public class BytecodeNameTest {
-
-    public BytecodeNameTest() {
-    }
-
-    @BeforeClass
-    public static void setUpClass() throws Exception {
-    }
-
-    @AfterClass
-    public static void tearDownClass() throws Exception {
-    }
-
-    static String[][] SAMPLES = {
-        // mangled, source
-        {"foo", "foo"},
-        {"ba\\r", "ba\\r"},
-        {"\\=ba\\-%z", "ba\\%z"},
-        {"\\=ba\\--z", "ba\\-z"},
-        {"=\\=", "=\\="},
-        {"\\==\\|\\=", "=/\\="},
-        {"\\|\\=", "/\\="},
-        {"\\=ba\\!", "ba:"},
-        {"\\|", "/"},
-        {"\\", "\\"},
-        {"\\\\%", "\\$"},
-        {"\\\\", "\\\\"},
-        {"\\=", ""}
-    };
-
-    static String[][] canonicalSamples() {
-        int ndc = DANGEROUS_CHARS.length();
-        String[][] res = new String[2*ndc][];
-        for (int i = 0; i < ndc; i++) {
-            char dc = DANGEROUS_CHARS.charAt(i);
-            char rc = REPLACEMENT_CHARS.charAt(i);
-            if (dc == '\\') {
-                res[2*i+0] = new String[] { "\\-%", "\\%" };
-            } else {
-                res[2*i+0] = new String[] { "\\"+rc, ""+dc };
-            }
-            res[2*i+1] = new String[] { ""+rc, ""+rc };
-        }
-        return res;
-    }
-
-    @Test
-    public void testToBytecodeName() {
-        System.out.println("toBytecodeName");
-        testToBytecodeName(SAMPLES);
-        testToBytecodeName(canonicalSamples());
-    }
-    public void testToBytecodeName(String[][] samples) {
-        for (String[] sample : samples) {
-            String s = sample[1];
-            String expResult = sample[0];
-            String result = BytecodeName.toBytecodeName(s);
-            if (!result.equals(expResult))
-                System.out.println(s+" => "+result+" != "+expResult);
-            assertEquals(expResult, result);
-        }
-    }
-
-    @Test
-    public void testToSourceName() {
-        System.out.println("toSourceName");
-        testToBytecodeName(SAMPLES);
-        testToBytecodeName(canonicalSamples());
-    }
-    public void testToSourceName(String[][] samples) {
-        for (String[] sample : samples) {
-            String s = sample[0];
-            String expResult = sample[1];
-            String result = BytecodeName.toBytecodeName(s);
-            assertEquals(expResult, result);
-        }
-    }
-
-    Object[][] PARSE_SAMPLES = {
-        {""},
-        {"/", '/'},
-        {"\\", "\\"},
-        {":foo", ':', "foo"},
-        {"\\=ba\\!", "ba:"},
-        {"java/lang/String", "java", '/', "lang", '/', "String"},
-        {"<init>", '<', "init", '>'},
-        {"foo/bar$:baz", "foo", '/', "bar", '$', ':', "baz"},
-        {"::\\=:foo:\\=bar\\!baz", ':', ':', "", ':', "foo", ':', "bar:baz"},
-    };
-
-    @Test
-    public void testParseBytecodeName() {
-        System.out.println("parseBytecodeName");
-        for (Object[] sample : PARSE_SAMPLES)
-            testParseBytecodeName((String) sample[0], Arrays.copyOfRange(sample, 1, sample.length));
-        for (String[] sample : SAMPLES) {
-            for (char dc : DANGEROUS_CHARS.toCharArray()) {
-                if (dc == '\\')  continue;
-                testParseBytecodeName(sample[0], sample[1]);
-                testParseBytecodeName(dc+sample[0], dc, sample[1]);
-                testParseBytecodeName(dc+sample[0]+dc, dc, sample[1], dc);
-                testParseBytecodeName(sample[0]+dc, sample[1], dc);
-            }
-        }
-    }
-    public void testParseBytecodeName(String s, Object... expResult) {
-        Object[] result = BytecodeName.parseBytecodeName(s);
-        if (!Arrays.equals(expResult, result))
-            System.out.println(s+" => "+Arrays.toString(result)+" != "+Arrays.toString(expResult));
-        assertArrayEquals(expResult, result);
-    }
-
-    @Test
-    public void testUnparseBytecodeName() {
-        System.out.println("unparseBytecodeName");
-        for (Object[] sample : PARSE_SAMPLES)
-            testUnparseBytecodeName((String) sample[0], Arrays.copyOfRange(sample, 1, sample.length));
-        for (String[] sample : SAMPLES) {
-            for (char dc : DANGEROUS_CHARS.toCharArray()) {
-                if (dc == '\\')  continue;
-                testUnparseBytecodeName(sample[0], sample[1]);
-                testUnparseBytecodeName(dc+sample[0], dc, sample[1]);
-                testUnparseBytecodeName(dc+sample[0]+dc, dc, sample[1], dc);
-                testUnparseBytecodeName(sample[0]+dc, sample[1], dc);
-            }
-        }
-    }
-    public void testUnparseBytecodeName(String expResult, Object... components) {
-        String result = BytecodeName.unparseBytecodeName(components);
-        assertEquals(expResult, result);
-    }
-
-    String[][] DISPLAY_SAMPLES = {
-        {"foo", "foo"},
-        {"", "" }, // not "''"
-        {"\\=", "''" }, // not ""
-        {"\\=,\\%,\\=", "',$,\\\\='" },
-        {"\\=.\\%.\\=", "''.'$'.''" },
-        {"123", "'123'"},
-        {"'", "'\\''"},
-        {"\\", "'\\\\'"},
-        {"java.lang", "java.lang"},
-        {"java.123", "java.'123'"},
-        {"123.lang", "'123'.lang"},
-        {"\\|", "'/'"},
-        {"foo:bar", "foo:bar"},
-        {"\\=foo\\!bar", "'foo:bar'"},
-        {"foo$bar", "foo$bar"},
-        {"\\=foo\\%bar", "'foo$bar'"},
-    };
-
-    @Test
-    public void testToDisplayName() {
-        System.out.println("toDisplayName");
-        for (String[] sample : DISPLAY_SAMPLES) {
-            String s = sample[0];
-            String expResult = sample[1];
-            String result = BytecodeName.toDisplayName(s);
-            if (!result.equals(expResult))
-                System.out.println(s+" => "+result+" != "+expResult);
-            assertEquals(expResult, result);
-        }
-    }
-
-    @Test
-    public void testIsSafeBytecodeName() {
-        System.out.println("isSafeBytecodeName");
-        String[] strings = {
-            // Safe strings:
-            "foo",
-            "\\",
-            "\\foo",
-            "\\=foo",
-            "foo\\",
-            "foo\\%",
-            "fo\\o",
-            "fo\\%o",
-            "123",
-            // Unsafe strings start with "":
-            "",
-            "foo:bar",
-            "<init>",
-            "/",
-        };
-        boolean expResult = true;
-        for (String s : strings) {
-            if (s.equals(""))  expResult = false;
-            boolean result = BytecodeName.isSafeBytecodeName(s);
-            assertEquals(expResult, result);
-        }
-    }
-
-    @Test
-    public void testIsSafeBytecodeChar() {
-        System.out.println("isSafeBytecodeChar");
-        for (char c = 0; c < 500; c++) {
-            boolean expResult = c == '\\' || DANGEROUS_CHARS.indexOf(c) < 0;
-            boolean result = BytecodeName.isSafeBytecodeChar(c);
-            assertEquals(expResult, result);
-        }
-    }
-
-    // optional test driver
-    static void main(String[] av) {
-        // If verbose is enabled, quietly check everything.
-        // Otherwise, print the output for the user to check.
-        boolean verbose = false;
-
-        int maxlen = 0;
-
-        while (av.length > 0 && av[0].startsWith("-")) {
-            String flag = av[0].intern();
-            av = java.util.Arrays.copyOfRange(av, 1, av.length); // Java 1.6 or later
-            if (flag == "-" || flag == "--")  break;
-            else if (flag == "-q")
-                verbose = false;
-            else if (flag == "-v")
-                verbose = true;
-            else if (flag.startsWith("-l"))
-                maxlen = Integer.valueOf(flag.substring(2));
-            else
-                throw new Error("Illegal flag argument: "+flag);
-        }
-
-        if (maxlen == 0)
-            maxlen = (verbose ? 2 : 4);
-        if (verbose)  System.out.println("Note: maxlen = "+maxlen);
-
-        switch (av.length) {
-        case 0: av = new String[] {
-                    DANGEROUS_CHARS.substring(0) +
-                    REPLACEMENT_CHARS.substring(0, 2) +
-                    NULL_ESCAPE + "x"
-                }; // and fall through:
-        case 1:
-            char[] cv = av[0].toCharArray();
-            av = new String[cv.length];
-            int avp = 0;
-            for (char c : cv) {
-                String s = String.valueOf(c);
-                if (c == 'x')  s = "foo";  // tradition...
-                av[avp++] = s;
-            }
-        }
-        if (verbose)
-            System.out.println("Note: Verbose output mode enabled.  Use '-q' to suppress.");
-        Tester t = new Tester();
-        t.maxlen = maxlen;
-        t.verbose = verbose;
-        t.tokens = av;
-        t.test("", 0);
-    }
-
-    static char ESCAPE_C = '\\';
-    // empty escape sequence to avoid a null name or illegal prefix
-    static char NULL_ESCAPE_C = '=';
-    static String NULL_ESCAPE = ESCAPE_C+""+NULL_ESCAPE_C;
-
-    static final String DANGEROUS_CHARS   = "\\/.;:$[]<>";
-    static final String REPLACEMENT_CHARS =  "-|,?!%{}^_";
-
-    @Test
-    public void testMangler() {
-        System.out.println("(mangler)");
-        Tester t = new Tester();
-        t.maxlen = 4;
-        String alphabet =
-            DANGEROUS_CHARS.substring(0) +
-            REPLACEMENT_CHARS.substring(0, 2) +
-            NULL_ESCAPE + "x";
-        t.tokens = new String[alphabet.length()];
-        int fill = 0;
-        for (char c : alphabet.toCharArray())
-            t.tokens[fill++] = String.valueOf(c);
-        t.test("", 0);
-        System.out.println("tested mangler exhaustively on "+t.map.size()+" strings to length "+t.maxlen);
-    }
-
-    static class Tester {
-        boolean verbose;
-        int maxlen;
-        java.util.Map<String,String> map = new java.util.HashMap<String,String>();
-        String[] tokens;
-
-        void test(String stringSoFar, int tokensSoFar) {
-            test(stringSoFar);
-            if (tokensSoFar <= maxlen) {
-                for (String token : tokens) {
-                    if (token.length() == 0)  continue;  // skip empty tokens
-                    if (stringSoFar.indexOf(token) != stringSoFar.lastIndexOf(token))
-                        continue;   // there are already two occs. of this token
-                    if (token.charAt(0) == ESCAPE_C && token.length() == 1 && maxlen < 4)
-                        test(stringSoFar+token, tokensSoFar);  // want lots of \'s
-                    else if (tokensSoFar < maxlen)
-                        test(stringSoFar+token, tokensSoFar+1);
-                }
-            }
-        }
-
-        void test(String s) {
-            // for small batches, do not test the null string
-            if (s.length() == 0 && maxlen >=1 && maxlen <= 2)  return;
-            String bn = testSourceName(s);
-            if (bn == null)  return;
-            if (bn == s) {
-                //if (verbose)  System.out.println(s+" == id");
-            } else {
-                if (verbose)  System.out.println(s+" => "+bn+" "+BytecodeName.toDisplayName(bn));
-                String bnbn = testSourceName(bn);
-                if (bnbn == null)  return;
-                if (verbose)  System.out.println(bn+" => "+bnbn+" "+BytecodeName.toDisplayName(bnbn));
-                /*
-                String bn3 = testSourceName(bnbn);
-                if (bn3 == null)  return;
-                if (verbose)  System.out.println(bnbn+" => "+bn3);
-                */
-            }
-        }
-
-        String testSourceName(String s) {
-            if (map.containsKey(s))  return null;
-            String bn = BytecodeName.toBytecodeName(s);
-            map.put(s, bn);
-            String sn = BytecodeName.toSourceName(bn);
-            if (!sn.equals(s)) {
-                String bad = (s+" => "+bn+" != "+sn);
-                if (!verbose)  throw new Error("Bad mangling: "+bad);
-                System.out.println("*** "+bad);
-                return null;
-            }
-            return bn;
-        }
-    }
-}
\ No newline at end of file
--- a/netbeans/meth/test/sun/dyn/util/ValueConversionsTest.java	Mon Apr 04 15:23:19 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,262 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.dyn.util;
-
-import java.dyn.MethodHandle;
-import java.dyn.MethodHandles;
-import java.io.Serializable;
-import java.util.Arrays;
-import org.junit.Ignore;
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-/**
- *
- * @author jrose
- */
-public class ValueConversionsTest {
-
-    @Test
-    public void testUnbox() throws Throwable {
-        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;
-                    case SHORT:  assertEquals(box.getClass(), Short.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 = (int)     unboxer.invokeExact(box); break;
-                    case LONG:    result = (long)    unboxer.invokeExact(box); break;
-                    case FLOAT:   result = (float)   unboxer.invokeExact(box); break;
-                    case DOUBLE:  result = (double)  unboxer.invokeExact(box); break;
-                    case CHAR:    result = (char)    unboxer.invokeExact(box); break;
-                    case BYTE:    result = (byte)    unboxer.invokeExact(box); break;
-                    case SHORT:   result = (short)   unboxer.invokeExact((Short)box); break;
-                    case OBJECT:  result = (Object)  unboxer.invokeExact(box); break;
-                    case BOOLEAN: result = (boolean) unboxer.invokeExact(box); break;
-                    case VOID:    result = null;     unboxer.invokeExact(box); break;
-                }
-                assertEquals("w="+w+" n="+n+" box="+box, expResult, result);
-            }
-        }
-    }
-
-    @Test
-    public void testUnboxRaw() throws Throwable {
-        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 = (int)  unboxer.invokeExact(box); break;
-                    case LONG:    result = (long) unboxer.invokeExact(box); break;
-                    case FLOAT:   result = (int)  unboxer.invokeExact(box); break;
-                    case DOUBLE:  result = (long) unboxer.invokeExact(box); break;
-                    case CHAR:    result = (int)  unboxer.invokeExact(box); break;
-                    case BYTE:    result = (int)  unboxer.invokeExact(box); break;
-                    case SHORT:   result = (int)  unboxer.invokeExact((Short)box); break;
-                    case BOOLEAN: result = (int)  unboxer.invokeExact(box); break;
-                    case VOID:    result = (int)  unboxer.invokeExact(box); break;
-                }
-                assertEquals("w="+w+" n="+n+" box="+box, expResult, result);
-            }
-        }
-    }
-
-    @Test
-    public void testBox() throws Throwable {
-        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 = (Integer)   boxer.invokeExact((int)n); break;
-                    case LONG:    result = (Long)      boxer.invokeExact((long)n); break;
-                    case FLOAT:   result = (Float)     boxer.invokeExact((float)n); break;
-                    case DOUBLE:  result = (Double)    boxer.invokeExact((double)n); break;
-                    case CHAR:    result = (Character) boxer.invokeExact((char)n); break;
-                    case BYTE:    result = (Byte)      boxer.invokeExact((byte)n); break;
-                    case SHORT:   result = (Object)    boxer.invokeExact((short)n); break;
-                    case OBJECT:  result = (Object)    boxer.invokeExact((Object)n); break;
-                    case BOOLEAN: result = (Boolean)   boxer.invokeExact(n != 0); break;
-                }
-                assertEquals("w="+w+" n="+n+" box="+box, expResult, result);
-            }
-        }
-    }
-
-    @Test
-    public void testBoxRaw() throws Throwable {
-        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 = (Integer)   boxer.invokeExact((int)raw); break;
-                case LONG:    result = (Long)      boxer.invokeExact(raw); break;
-                case FLOAT:   result = (Float)     boxer.invokeExact((int)raw); break;
-                case DOUBLE:  result = (Double)    boxer.invokeExact(raw); break;
-                case CHAR:    result = (Character) boxer.invokeExact((int)raw); break;
-                case BYTE:    result = (Byte)      boxer.invokeExact((int)raw); break;
-                case SHORT:   result = (Object)    boxer.invokeExact((int)raw); break;
-                case BOOLEAN: result = (Boolean)   boxer.invokeExact((int)raw); break;
-                }
-                assertEquals("w="+w+" n="+n+" box="+box, expResult, result);
-            }
-        }
-    }
-
-    @Test
-    public void testReboxRaw() throws Throwable {
-        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 = (Integer)   boxer.invokeExact(raw); break;
-                case LONG:    result = (Long)      boxer.invokeExact(raw); break;
-                case FLOAT:   result = (Float)     boxer.invokeExact(raw); break;
-                case DOUBLE:  result = (Double)    boxer.invokeExact(raw); break;
-                case CHAR:    result = (Character) boxer.invokeExact(raw); break;
-                case BYTE:    result = (Byte)      boxer.invokeExact(raw); break;
-                case SHORT:   result = (Object)    boxer.invokeExact(raw); break;
-                case BOOLEAN: result = (Boolean)   boxer.invokeExact(raw); break;
-                }
-                assertEquals("w="+w+" n="+n+" box="+box, expResult, result);
-            }
-        }
-    }
-
-    @Test
-    public void testCast() throws Throwable {
-        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.invokeExact(obj);
-                    else
-                        result = (Integer) caster.invokeExact(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() throws Throwable {
-        System.out.println("identity");
-        MethodHandle id = ValueConversions.identity();
-        Object expResult = "foo";
-        Object result = id.invokeExact(expResult);
-        // compiler bug:  ValueConversions.identity().invokeExact("bar");
-        assertEquals(expResult, result);
-    }
-
-    @Test
-    public void testVarargsArray() throws Throwable {
-        System.out.println("varargsArray");
-        for (int nargs = 0; nargs <= 5; nargs++) {
-            MethodHandle target = ValueConversions.varargsArray(nargs);
-            Object[] args = new Object[nargs];
-            for (int i = 0; i < nargs; i++)
-                args[i] = "#"+i;
-            Object res = target.invokeWithArguments(args);
-            assertArrayEquals(args, (Object[])res);
-        }
-    }
-
-    @Test
-    public void testVarargsList() throws Throwable {
-        System.out.println("varargsList");
-        for (int nargs = 0; nargs <= 5; nargs++) {
-            MethodHandle target = ValueConversions.varargsList(nargs);
-            Object[] args = new Object[nargs];
-            for (int i = 0; i < nargs; i++)
-                args[i] = "#"+i;
-            Object res = target.invokeWithArguments(args);
-            assertEquals(Arrays.asList(args), res);
-        }
-    }
-}
\ No newline at end of file
--- a/netbeans/meth/test/sun/dyn/util/WrapperTest.java	Mon Apr 04 15:23:19 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.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/invoke/util/BytecodeNameTest.java	Mon Apr 04 15:23:43 2011 -0700
@@ -0,0 +1,369 @@
+/*
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.invoke.util;
+
+import java.util.Arrays;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author jrose
+ */
+public class BytecodeNameTest {
+
+    public BytecodeNameTest() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+    }
+
+    static String[][] SAMPLES = {
+        // mangled, source
+        {"foo", "foo"},
+        {"ba\\r", "ba\\r"},
+        {"\\=ba\\-%z", "ba\\%z"},
+        {"\\=ba\\--z", "ba\\-z"},
+        {"=\\=", "=\\="},
+        {"\\==\\|\\=", "=/\\="},
+        {"\\|\\=", "/\\="},
+        {"\\=ba\\!", "ba:"},
+        {"\\|", "/"},
+        {"\\", "\\"},
+        {"\\\\%", "\\$"},
+        {"\\\\", "\\\\"},
+        {"\\=", ""}
+    };
+
+    static String[][] canonicalSamples() {
+        int ndc = DANGEROUS_CHARS.length();
+        String[][] res = new String[2*ndc][];
+        for (int i = 0; i < ndc; i++) {
+            char dc = DANGEROUS_CHARS.charAt(i);
+            char rc = REPLACEMENT_CHARS.charAt(i);
+            if (dc == '\\') {
+                res[2*i+0] = new String[] { "\\-%", "\\%" };
+            } else {
+                res[2*i+0] = new String[] { "\\"+rc, ""+dc };
+            }
+            res[2*i+1] = new String[] { ""+rc, ""+rc };
+        }
+        return res;
+    }
+
+    @Test
+    public void testToBytecodeName() {
+        System.out.println("toBytecodeName");
+        testToBytecodeName(SAMPLES);
+        testToBytecodeName(canonicalSamples());
+    }
+    public void testToBytecodeName(String[][] samples) {
+        for (String[] sample : samples) {
+            String s = sample[1];
+            String expResult = sample[0];
+            String result = BytecodeName.toBytecodeName(s);
+            if (!result.equals(expResult))
+                System.out.println(s+" => "+result+" != "+expResult);
+            assertEquals(expResult, result);
+        }
+    }
+
+    @Test
+    public void testToSourceName() {
+        System.out.println("toSourceName");
+        testToBytecodeName(SAMPLES);
+        testToBytecodeName(canonicalSamples());
+    }
+    public void testToSourceName(String[][] samples) {
+        for (String[] sample : samples) {
+            String s = sample[0];
+            String expResult = sample[1];
+            String result = BytecodeName.toBytecodeName(s);
+            assertEquals(expResult, result);
+        }
+    }
+
+    Object[][] PARSE_SAMPLES = {
+        {""},
+        {"/", '/'},
+        {"\\", "\\"},
+        {":foo", ':', "foo"},
+        {"\\=ba\\!", "ba:"},
+        {"java/lang/String", "java", '/', "lang", '/', "String"},
+        {"<init>", '<', "init", '>'},
+        {"foo/bar$:baz", "foo", '/', "bar", '$', ':', "baz"},
+        {"::\\=:foo:\\=bar\\!baz", ':', ':', "", ':', "foo", ':', "bar:baz"},
+    };
+
+    @Test
+    public void testParseBytecodeName() {
+        System.out.println("parseBytecodeName");
+        for (Object[] sample : PARSE_SAMPLES)
+            testParseBytecodeName((String) sample[0], Arrays.copyOfRange(sample, 1, sample.length));
+        for (String[] sample : SAMPLES) {
+            for (char dc : DANGEROUS_CHARS.toCharArray()) {
+                if (dc == '\\')  continue;
+                testParseBytecodeName(sample[0], sample[1]);
+                testParseBytecodeName(dc+sample[0], dc, sample[1]);
+                testParseBytecodeName(dc+sample[0]+dc, dc, sample[1], dc);
+                testParseBytecodeName(sample[0]+dc, sample[1], dc);
+            }
+        }
+    }
+    public void testParseBytecodeName(String s, Object... expResult) {
+        Object[] result = BytecodeName.parseBytecodeName(s);
+        if (!Arrays.equals(expResult, result))
+            System.out.println(s+" => "+Arrays.toString(result)+" != "+Arrays.toString(expResult));
+        assertArrayEquals(expResult, result);
+    }
+
+    @Test
+    public void testUnparseBytecodeName() {
+        System.out.println("unparseBytecodeName");
+        for (Object[] sample : PARSE_SAMPLES)
+            testUnparseBytecodeName((String) sample[0], Arrays.copyOfRange(sample, 1, sample.length));
+        for (String[] sample : SAMPLES) {
+            for (char dc : DANGEROUS_CHARS.toCharArray()) {
+                if (dc == '\\')  continue;
+                testUnparseBytecodeName(sample[0], sample[1]);
+                testUnparseBytecodeName(dc+sample[0], dc, sample[1]);
+                testUnparseBytecodeName(dc+sample[0]+dc, dc, sample[1], dc);
+                testUnparseBytecodeName(sample[0]+dc, sample[1], dc);
+            }
+        }
+    }
+    public void testUnparseBytecodeName(String expResult, Object... components) {
+        String result = BytecodeName.unparseBytecodeName(components);
+        assertEquals(expResult, result);
+    }
+
+    String[][] DISPLAY_SAMPLES = {
+        {"foo", "foo"},
+        {"", "" }, // not "''"
+        {"\\=", "''" }, // not ""
+        {"\\=,\\%,\\=", "',$,\\\\='" },
+        {"\\=.\\%.\\=", "''.'$'.''" },
+        {"123", "'123'"},
+        {"'", "'\\''"},
+        {"\\", "'\\\\'"},
+        {"java.lang", "java.lang"},
+        {"java.123", "java.'123'"},
+        {"123.lang", "'123'.lang"},
+        {"\\|", "'/'"},
+        {"foo:bar", "foo:bar"},
+        {"\\=foo\\!bar", "'foo:bar'"},
+        {"foo$bar", "foo$bar"},
+        {"\\=foo\\%bar", "'foo$bar'"},
+    };
+
+    @Test
+    public void testToDisplayName() {
+        System.out.println("toDisplayName");
+        for (String[] sample : DISPLAY_SAMPLES) {
+            String s = sample[0];
+            String expResult = sample[1];
+            String result = BytecodeName.toDisplayName(s);
+            if (!result.equals(expResult))
+                System.out.println(s+" => "+result+" != "+expResult);
+            assertEquals(expResult, result);
+        }
+    }
+
+    @Test
+    public void testIsSafeBytecodeName() {
+        System.out.println("isSafeBytecodeName");
+        String[] strings = {
+            // Safe strings:
+            "foo",
+            "\\",
+            "\\foo",
+            "\\=foo",
+            "foo\\",
+            "foo\\%",
+            "fo\\o",
+            "fo\\%o",
+            "123",
+            // Unsafe strings start with "":
+            "",
+            "foo:bar",
+            "<init>",
+            "/",
+        };
+        boolean expResult = true;
+        for (String s : strings) {
+            if (s.equals(""))  expResult = false;
+            boolean result = BytecodeName.isSafeBytecodeName(s);
+            assertEquals(expResult, result);
+        }
+    }
+
+    @Test
+    public void testIsSafeBytecodeChar() {
+        System.out.println("isSafeBytecodeChar");
+        for (char c = 0; c < 500; c++) {
+            boolean expResult = c == '\\' || DANGEROUS_CHARS.indexOf(c) < 0;
+            boolean result = BytecodeName.isSafeBytecodeChar(c);
+            assertEquals(expResult, result);
+        }
+    }
+
+    // optional test driver
+    static void main(String[] av) {
+        // If verbose is enabled, quietly check everything.
+        // Otherwise, print the output for the user to check.
+        boolean verbose = false;
+
+        int maxlen = 0;
+
+        while (av.length > 0 && av[0].startsWith("-")) {
+            String flag = av[0].intern();
+            av = java.util.Arrays.copyOfRange(av, 1, av.length); // Java 1.6 or later
+            if (flag == "-" || flag == "--")  break;
+            else if (flag == "-q")
+                verbose = false;
+            else if (flag == "-v")
+                verbose = true;
+            else if (flag.startsWith("-l"))
+                maxlen = Integer.valueOf(flag.substring(2));
+            else
+                throw new Error("Illegal flag argument: "+flag);
+        }
+
+        if (maxlen == 0)
+            maxlen = (verbose ? 2 : 4);
+        if (verbose)  System.out.println("Note: maxlen = "+maxlen);
+
+        switch (av.length) {
+        case 0: av = new String[] {
+                    DANGEROUS_CHARS.substring(0) +
+                    REPLACEMENT_CHARS.substring(0, 2) +
+                    NULL_ESCAPE + "x"
+                }; // and fall through:
+        case 1:
+            char[] cv = av[0].toCharArray();
+            av = new String[cv.length];
+            int avp = 0;
+            for (char c : cv) {
+                String s = String.valueOf(c);
+                if (c == 'x')  s = "foo";  // tradition...
+                av[avp++] = s;
+            }
+        }
+        if (verbose)
+            System.out.println("Note: Verbose output mode enabled.  Use '-q' to suppress.");
+        Tester t = new Tester();
+        t.maxlen = maxlen;
+        t.verbose = verbose;
+        t.tokens = av;
+        t.test("", 0);
+    }
+
+    static char ESCAPE_C = '\\';
+    // empty escape sequence to avoid a null name or illegal prefix
+    static char NULL_ESCAPE_C = '=';
+    static String NULL_ESCAPE = ESCAPE_C+""+NULL_ESCAPE_C;
+
+    static final String DANGEROUS_CHARS   = "\\/.;:$[]<>";
+    static final String REPLACEMENT_CHARS =  "-|,?!%{}^_";
+
+    @Test
+    public void testMangler() {
+        System.out.println("(mangler)");
+        Tester t = new Tester();
+        t.maxlen = 4;
+        String alphabet =
+            DANGEROUS_CHARS.substring(0) +
+            REPLACEMENT_CHARS.substring(0, 2) +
+            NULL_ESCAPE + "x";
+        t.tokens = new String[alphabet.length()];
+        int fill = 0;
+        for (char c : alphabet.toCharArray())
+            t.tokens[fill++] = String.valueOf(c);
+        t.test("", 0);
+        System.out.println("tested mangler exhaustively on "+t.map.size()+" strings to length "+t.maxlen);
+    }
+
+    static class Tester {
+        boolean verbose;
+        int maxlen;
+        java.util.Map<String,String> map = new java.util.HashMap<String,String>();
+        String[] tokens;
+
+        void test(String stringSoFar, int tokensSoFar) {
+            test(stringSoFar);
+            if (tokensSoFar <= maxlen) {
+                for (String token : tokens) {
+                    if (token.length() == 0)  continue;  // skip empty tokens
+                    if (stringSoFar.indexOf(token) != stringSoFar.lastIndexOf(token))
+                        continue;   // there are already two occs. of this token
+                    if (token.charAt(0) == ESCAPE_C && token.length() == 1 && maxlen < 4)
+                        test(stringSoFar+token, tokensSoFar);  // want lots of \'s
+                    else if (tokensSoFar < maxlen)
+                        test(stringSoFar+token, tokensSoFar+1);
+                }
+            }
+        }
+
+        void test(String s) {
+            // for small batches, do not test the null string
+            if (s.length() == 0 && maxlen >=1 && maxlen <= 2)  return;
+            String bn = testSourceName(s);
+            if (bn == null)  return;
+            if (bn == s) {
+                //if (verbose)  System.out.println(s+" == id");
+            } else {
+                if (verbose)  System.out.println(s+" => "+bn+" "+BytecodeName.toDisplayName(bn));
+                String bnbn = testSourceName(bn);
+                if (bnbn == null)  return;
+                if (verbose)  System.out.println(bn+" => "+bnbn+" "+BytecodeName.toDisplayName(bnbn));
+                /*
+                String bn3 = testSourceName(bnbn);
+                if (bn3 == null)  return;
+                if (verbose)  System.out.println(bnbn+" => "+bn3);
+                */
+            }
+        }
+
+        String testSourceName(String s) {
+            if (map.containsKey(s))  return null;
+            String bn = BytecodeName.toBytecodeName(s);
+            map.put(s, bn);
+            String sn = BytecodeName.toSourceName(bn);
+            if (!sn.equals(s)) {
+                String bad = (s+" => "+bn+" != "+sn);
+                if (!verbose)  throw new Error("Bad mangling: "+bad);
+                System.out.println("*** "+bad);
+                return null;
+            }
+            return bn;
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netbeans/meth/test/sun/invoke/util/ValueConversionsTest.java	Mon Apr 04 15:23:43 2011 -0700
@@ -0,0 +1,262 @@
+/*
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.invoke.util;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.io.Serializable;
+import java.util.Arrays;
+import org.junit.Ignore;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author jrose
+ */
+public class ValueConversionsTest {
+
+    @Test
+    public void testUnbox() throws Throwable {
+        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;
+                    case SHORT:  assertEquals(box.getClass(), Short.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 = (int)     unboxer.invokeExact(box); break;
+                    case LONG:    result = (long)    unboxer.invokeExact(box); break;
+                    case FLOAT:   result = (float)   unboxer.invokeExact(box); break;
+                    case DOUBLE:  result = (double)  unboxer.invokeExact(box); break;
+                    case CHAR:    result = (char)    unboxer.invokeExact(box); break;
+                    case BYTE:    result = (byte)    unboxer.invokeExact(box); break;
+                    case SHORT:   result = (short)   unboxer.invokeExact((Short)box); break;
+                    case OBJECT:  result = (Object)  unboxer.invokeExact(box); break;
+                    case BOOLEAN: result = (boolean) unboxer.invokeExact(box); break;
+                    case VOID:    result = null;     unboxer.invokeExact(box); break;
+                }
+                assertEquals("w="+w+" n="+n+" box="+box, expResult, result);
+            }
+        }
+    }
+
+    @Test
+    public void testUnboxRaw() throws Throwable {
+        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 = (int)  unboxer.invokeExact(box); break;
+                    case LONG:    result = (long) unboxer.invokeExact(box); break;
+                    case FLOAT:   result = (int)  unboxer.invokeExact(box); break;
+                    case DOUBLE:  result = (long) unboxer.invokeExact(box); break;
+                    case CHAR:    result = (int)  unboxer.invokeExact(box); break;
+                    case BYTE:    result = (int)  unboxer.invokeExact(box); break;
+                    case SHORT:   result = (int)  unboxer.invokeExact((Short)box); break;
+                    case BOOLEAN: result = (int)  unboxer.invokeExact(box); break;
+                    case VOID:    result = (int)  unboxer.invokeExact(box); break;
+                }
+                assertEquals("w="+w+" n="+n+" box="+box, expResult, result);
+            }
+        }
+    }
+
+    @Test
+    public void testBox() throws Throwable {
+        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 = (Integer)   boxer.invokeExact((int)n); break;
+                    case LONG:    result = (Long)      boxer.invokeExact((long)n); break;
+                    case FLOAT:   result = (Float)     boxer.invokeExact((float)n); break;
+                    case DOUBLE:  result = (Double)    boxer.invokeExact((double)n); break;
+                    case CHAR:    result = (Character) boxer.invokeExact((char)n); break;
+                    case BYTE:    result = (Byte)      boxer.invokeExact((byte)n); break;
+                    case SHORT:   result = (Object)    boxer.invokeExact((short)n); break;
+                    case OBJECT:  result = (Object)    boxer.invokeExact((Object)n); break;
+                    case BOOLEAN: result = (Boolean)   boxer.invokeExact(n != 0); break;
+                }
+                assertEquals("w="+w+" n="+n+" box="+box, expResult, result);
+            }
+        }
+    }
+
+    @Test
+    public void testBoxRaw() throws Throwable {
+        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 = (Integer)   boxer.invokeExact((int)raw); break;
+                case LONG:    result = (Long)      boxer.invokeExact(raw); break;
+                case FLOAT:   result = (Float)     boxer.invokeExact((int)raw); break;
+                case DOUBLE:  result = (Double)    boxer.invokeExact(raw); break;
+                case CHAR:    result = (Character) boxer.invokeExact((int)raw); break;
+                case BYTE:    result = (Byte)      boxer.invokeExact((int)raw); break;
+                case SHORT:   result = (Object)    boxer.invokeExact((int)raw); break;
+                case BOOLEAN: result = (Boolean)   boxer.invokeExact((int)raw); break;
+                }
+                assertEquals("w="+w+" n="+n+" box="+box, expResult, result);
+            }
+        }
+    }
+
+    @Test
+    public void testReboxRaw() throws Throwable {
+        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 = (Integer)   boxer.invokeExact(raw); break;
+                case LONG:    result = (Long)      boxer.invokeExact(raw); break;
+                case FLOAT:   result = (Float)     boxer.invokeExact(raw); break;
+                case DOUBLE:  result = (Double)    boxer.invokeExact(raw); break;
+                case CHAR:    result = (Character) boxer.invokeExact(raw); break;
+                case BYTE:    result = (Byte)      boxer.invokeExact(raw); break;
+                case SHORT:   result = (Object)    boxer.invokeExact(raw); break;
+                case BOOLEAN: result = (Boolean)   boxer.invokeExact(raw); break;
+                }
+                assertEquals("w="+w+" n="+n+" box="+box, expResult, result);
+            }
+        }
+    }
+
+    @Test
+    public void testCast() throws Throwable {
+        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.invokeExact(obj);
+                    else
+                        result = (Integer) caster.invokeExact(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() throws Throwable {
+        System.out.println("identity");
+        MethodHandle id = ValueConversions.identity();
+        Object expResult = "foo";
+        Object result = id.invokeExact(expResult);
+        // compiler bug:  ValueConversions.identity().invokeExact("bar");
+        assertEquals(expResult, result);
+    }
+
+    @Test
+    public void testVarargsArray() throws Throwable {
+        System.out.println("varargsArray");
+        for (int nargs = 0; nargs <= 5; nargs++) {
+            MethodHandle target = ValueConversions.varargsArray(nargs);
+            Object[] args = new Object[nargs];
+            for (int i = 0; i < nargs; i++)
+                args[i] = "#"+i;
+            Object res = target.invokeWithArguments(args);
+            assertArrayEquals(args, (Object[])res);
+        }
+    }
+
+    @Test
+    public void testVarargsList() throws Throwable {
+        System.out.println("varargsList");
+        for (int nargs = 0; nargs <= 5; nargs++) {
+            MethodHandle target = ValueConversions.varargsList(nargs);
+            Object[] args = new Object[nargs];
+            for (int i = 0; i < nargs; i++)
+                args[i] = "#"+i;
+            Object res = target.invokeWithArguments(args);
+            assertEquals(Arrays.asList(args), res);
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netbeans/meth/test/sun/invoke/util/WrapperTest.java	Mon Apr 04 15:23:43 2011 -0700
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.invoke.util;
+
+import org.junit.Test;
+import sun.invoke.util.Wrapper;
+import static sun.invoke.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