changeset 51193:ecc13f6cc610 condy-folding

fixing a merge issue plus additional tests failing
author vromero
date Fri, 15 Jun 2018 11:14:31 -0700
parents ba377e62b185
children 0a0371f27986
files src/java.base/share/classes/java/lang/constant/DirectMethodHandleDesc.java src/java.base/share/classes/java/lang/constant/MethodHandleDesc.java test/langtools/tools/javac/specialConstantFolding/checkMethodTypeShape/MethodTypeNegTest.out test/langtools/tools/javac/specialConstantFolding/dead_code_elimination/DontDoDCEOfConstableTest.java test/langtools/tools/javac/specialConstantFolding/harness/tests/ConstantDefinitions.java test/langtools/tools/javac/specialConstantFolding/harness/tests/ConstantFoldingOfMethodTypeDiffContextsTest.java test/langtools/tools/javac/specialConstantFolding/harness/tests/ConstantPropagationTest.java test/langtools/tools/javac/specialConstantFolding/harness/tests/EffectivelyFinalTest.java test/langtools/tools/javac/specialConstantFolding/harness/tests/FindConstructorTest.java test/langtools/tools/javac/specialConstantFolding/harness/tests/FindGetterTest.java test/langtools/tools/javac/specialConstantFolding/harness/tests/FindMethodWithGenericArgumentsTest.java test/langtools/tools/javac/specialConstantFolding/harness/tests/FindSetterTest.java test/langtools/tools/javac/specialConstantFolding/harness/tests/FindStaticGetterTest.java test/langtools/tools/javac/specialConstantFolding/harness/tests/FindStaticSetterTest.java test/langtools/tools/javac/specialConstantFolding/harness/tests/FindStaticTest.java test/langtools/tools/javac/specialConstantFolding/harness/tests/FindVirtualTest01.java test/langtools/tools/javac/specialConstantFolding/harness/tests/FindVirtualTest02.java test/langtools/tools/javac/specialConstantFolding/harness/tests/InstanceTrackableMethodsTest.java test/langtools/tools/javac/specialConstantFolding/harness/tests/StringFoldingTest.java
diffstat 19 files changed, 61 insertions(+), 95 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/constant/DirectMethodHandleDesc.java	Thu Jun 14 21:00:37 2018 -0700
+++ b/src/java.base/share/classes/java/lang/constant/DirectMethodHandleDesc.java	Fri Jun 15 11:14:31 2018 -0700
@@ -56,27 +56,27 @@
      */
     enum Kind {
         /** A method handle for a method invoked as with {@code invokestatic} */
-        STATIC(REF_invokeStatic),
+        @Foldable STATIC(REF_invokeStatic),
         /** A method handle for a method invoked as with {@code invokestatic} */
-        INTERFACE_STATIC(REF_invokeStatic, true),
+        @Foldable INTERFACE_STATIC(REF_invokeStatic, true),
         /** A method handle for a method invoked as with {@code invokevirtual} */
-        VIRTUAL(REF_invokeVirtual),
+        @Foldable VIRTUAL(REF_invokeVirtual),
         /** A method handle for a method invoked as with {@code invokeinterface} */
-        INTERFACE_VIRTUAL(REF_invokeInterface, true),
+        @Foldable INTERFACE_VIRTUAL(REF_invokeInterface, true),
         /** A method handle for a method invoked as with {@code invokespecial} */
-        SPECIAL(REF_invokeSpecial),
+        @Foldable SPECIAL(REF_invokeSpecial),
         /** A method handle for an interface method invoked as with {@code invokespecial} */
-        INTERFACE_SPECIAL(REF_invokeSpecial, true),
+        @Foldable INTERFACE_SPECIAL(REF_invokeSpecial, true),
         /** A method handle for a constructor */
-        CONSTRUCTOR(REF_newInvokeSpecial),
+        @Foldable CONSTRUCTOR(REF_newInvokeSpecial),
         /** A method handle for a read accessor for an instance field  */
-        GETTER(REF_getField),
+        @Foldable GETTER(REF_getField),
         /** A method handle for a write accessor for an instance field  */
-        SETTER(REF_putField),
+        @Foldable SETTER(REF_putField),
         /** A method handle for a read accessor for a static field  */
-        STATIC_GETTER(REF_getStatic),
+        @Foldable STATIC_GETTER(REF_getStatic),
         /** A method handle for a write accessor for a static field  */
-        STATIC_SETTER(REF_putStatic);
+        @Foldable STATIC_SETTER(REF_putStatic);
 
         /** The corresponding {@code refKind} value for this kind of method handle,
          * as defined by {@link MethodHandleInfo}
--- a/src/java.base/share/classes/java/lang/constant/MethodHandleDesc.java	Thu Jun 14 21:00:37 2018 -0700
+++ b/src/java.base/share/classes/java/lang/constant/MethodHandleDesc.java	Fri Jun 15 11:14:31 2018 -0700
@@ -71,6 +71,7 @@
      * format
      * @jvms 4.2.2 Unqualified Names
      */
+    @Foldable
     static DirectMethodHandleDesc of(DirectMethodHandleDesc.Kind kind,
                                      ClassDesc clazz,
                                      String name,
--- a/test/langtools/tools/javac/specialConstantFolding/checkMethodTypeShape/MethodTypeNegTest.out	Thu Jun 14 21:00:37 2018 -0700
+++ b/test/langtools/tools/javac/specialConstantFolding/checkMethodTypeShape/MethodTypeNegTest.out	Fri Jun 15 11:14:31 2018 -0700
@@ -1,11 +1,11 @@
-MethodTypeNegTest.java:17:50: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Expected type of (RT)V for getter, found MethodTypeDesc[()int]
-MethodTypeNegTest.java:18:50: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Expected type of (T)V for getter, found MethodTypeDesc[()int]
-MethodTypeNegTest.java:21:50: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Expected type of (RT)V for getter, found MethodTypeDesc[(int)void]
-MethodTypeNegTest.java:22:50: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Expected type of (T)V for getter, found MethodTypeDesc[(int,int)void]
-MethodTypeNegTest.java:25:50: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Expected type of (T*)V for constructor, found MethodTypeDesc[()int]
-MethodTypeNegTest.java:28:50: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Expected type of (R)T for getter, found MethodTypeDesc[()void]
-MethodTypeNegTest.java:29:50: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Expected type of ()T for getter, found MethodTypeDesc[()void]
-MethodTypeNegTest.java:32:50: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Expected type of (R)T for getter, found MethodTypeDesc[(int,int)int]
-MethodTypeNegTest.java:33:50: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Expected type of ()T for getter, found MethodTypeDesc[(int,int)int]
-MethodTypeNegTest.java:36:51: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Void parameters not permitted
+MethodTypeNegTest.java:14:50: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Expected type of (RT)V for getter, found MethodTypeDesc[()int]
+MethodTypeNegTest.java:15:50: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Expected type of (T)V for getter, found MethodTypeDesc[()int]
+MethodTypeNegTest.java:18:50: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Expected type of (RT)V for getter, found MethodTypeDesc[(int)void]
+MethodTypeNegTest.java:19:50: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Expected type of (T)V for getter, found MethodTypeDesc[(int,int)void]
+MethodTypeNegTest.java:22:50: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Expected type of (T*)V for constructor, found MethodTypeDesc[()int]
+MethodTypeNegTest.java:25:50: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Expected type of (R)T for getter, found MethodTypeDesc[()void]
+MethodTypeNegTest.java:26:50: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Expected type of ()T for getter, found MethodTypeDesc[()void]
+MethodTypeNegTest.java:29:50: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Expected type of (R)T for getter, found MethodTypeDesc[(int,int)int]
+MethodTypeNegTest.java:30:50: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Expected type of ()T for getter, found MethodTypeDesc[(int,int)int]
+MethodTypeNegTest.java:33:51: compiler.err.reflective.error: of, java.lang.constant.MethodHandleDesc, Void parameters not permitted
 10 errors
--- a/test/langtools/tools/javac/specialConstantFolding/dead_code_elimination/DontDoDCEOfConstableTest.java	Thu Jun 14 21:00:37 2018 -0700
+++ b/test/langtools/tools/javac/specialConstantFolding/dead_code_elimination/DontDoDCEOfConstableTest.java	Fri Jun 15 11:14:31 2018 -0700
@@ -108,8 +108,8 @@
             "*/\n" +
             "public class Stub {\n" +
             "   private static final ClassDesc CR_BOX = ClassDesc.of(\"java.lang.constant.Stub\").inner(\"Box\");\n" +
-            "   private static final ConstantMethodHandleDesc MH_BOX = ConstantDescs.ofConstantBootstrap(CR_BOX, \"constantBootstrap\", CR_BOX, CR_String);\n" +
-            "   //private static final MethodHandleDesc MH_BOX = MethodHandleDesc.of(MethodHandleDesc.Kind.CONSTRUCTOR, CR_BOX, \"_\", CR_void, CR_String);\n" +
+            "   private static final DirectMethodHandleDesc MH_BOX = ConstantDescs.ofConstantBootstrap(CR_BOX, \"constantBootstrap\", CR_BOX, CR_String);\n" +
+            "   //private static final MethodHandleDesc MH_BOX = MethodHandleDesc.of(DirectMethodHandleDesc.Kind.CONSTRUCTOR, CR_BOX, \"_\", CR_void, CR_String);\n" +
             "   /**\n" +
             "    * x\n" +
             "    * @return x\n" +
@@ -166,8 +166,8 @@
             "       }\n" +
             "\n" +
             "       @Override\n" +
-            "       public Optional<? extends ConstantDesc<? super Box>> describeConstable(MethodHandles.Lookup lookup) {\n" +
-            "           return Optional.of(DynamicConstantDesc.of(MH_BOX, CR_BOX)\n" +
+            "       public Optional<? extends ConstantDesc<Box>> describeConstable() {\n" +
+            "           return Optional.of(DynamicConstantDesc.<Box>of(MH_BOX, CR_BOX)\n" +
             "                   .withArgs(s));\n" +
             "       }\n" +
             "   }\n" +
--- a/test/langtools/tools/javac/specialConstantFolding/harness/tests/ConstantDefinitions.java	Thu Jun 14 21:00:37 2018 -0700
+++ b/test/langtools/tools/javac/specialConstantFolding/harness/tests/ConstantDefinitions.java	Fri Jun 15 11:14:31 2018 -0700
@@ -1,8 +1,7 @@
 /* /nodynamiccopyright/ */
 
 import java.lang.invoke.*;
-import java.lang.constant.MethodTypeDesc;
-import java.lang.constant.ConstantDescs;
+import java.lang.constant.*;
 
 import static java.lang.invoke.Intrinsics.*;
 
--- a/test/langtools/tools/javac/specialConstantFolding/harness/tests/ConstantFoldingOfMethodTypeDiffContextsTest.java	Thu Jun 14 21:00:37 2018 -0700
+++ b/test/langtools/tools/javac/specialConstantFolding/harness/tests/ConstantFoldingOfMethodTypeDiffContextsTest.java	Fri Jun 15 11:14:31 2018 -0700
@@ -2,8 +2,7 @@
 
 import java.io.Serializable;
 import java.lang.invoke.*;
-import java.lang.constant.ConstantDescs;
-import java.lang.constant.MethodTypeDesc;
+import java.lang.constant.*;
 
 import static java.lang.invoke.Intrinsics.*;
 
--- a/test/langtools/tools/javac/specialConstantFolding/harness/tests/ConstantPropagationTest.java	Thu Jun 14 21:00:37 2018 -0700
+++ b/test/langtools/tools/javac/specialConstantFolding/harness/tests/ConstantPropagationTest.java	Fri Jun 15 11:14:31 2018 -0700
@@ -1,9 +1,7 @@
 /* /nodynamiccopyright/ */
 
 import java.lang.invoke.*;
-import java.lang.constant.ClassDesc;
-import java.lang.constant.MethodTypeDesc;
-
+import java.lang.constant.*;
 import static java.lang.invoke.Intrinsics.*;
 
 @SkipExecution
--- a/test/langtools/tools/javac/specialConstantFolding/harness/tests/EffectivelyFinalTest.java	Thu Jun 14 21:00:37 2018 -0700
+++ b/test/langtools/tools/javac/specialConstantFolding/harness/tests/EffectivelyFinalTest.java	Fri Jun 15 11:14:31 2018 -0700
@@ -1,10 +1,7 @@
 /* /nodynamiccopyright/ */
 
 import java.lang.invoke.*;
-import java.lang.constant.ClassDesc;
-import java.lang.constant.MethodHandleDesc;
-import java.lang.constant.MethodTypeDesc;
-
+import java.lang.constant.*;
 import static java.lang.invoke.Intrinsics.*;
 
 public class EffectivelyFinalTest extends ConstantFoldingTest {
@@ -39,7 +36,7 @@
     void test3(EffectivelyFinalTest f) throws Throwable {
         ClassDesc c = ClassDesc.ofDescriptor("Ljava/lang/String;");
         MethodTypeDesc mt = MethodTypeDesc.of(c);
-        MethodHandle mh = ldc(MethodHandleDesc.of(MethodHandleDesc.Kind.VIRTUAL, ClassDesc.ofDescriptor("LEffectivelyFinalTest;"), "foo", mt));
+        MethodHandle mh = ldc(MethodHandleDesc.of(DirectMethodHandleDesc.Kind.VIRTUAL, ClassDesc.ofDescriptor("LEffectivelyFinalTest;"), "foo", mt));
         check(mh.invoke(f).toString().equals("invoking EffectivelyFinalTest.foo()"));
     }
 
@@ -47,7 +44,7 @@
     void test4(EffectivelyFinalTest f) throws Throwable {
         ClassDesc c = ClassDesc.ofDescriptor("Ljava/lang/String;");
         MethodTypeDesc mt = MethodTypeDesc.of(c);
-        final MethodHandle mh = ldc(MethodHandleDesc.of(MethodHandleDesc.Kind.VIRTUAL, ClassDesc.ofDescriptor("LEffectivelyFinalTest;"), "foo", mt));
+        final MethodHandle mh = ldc(MethodHandleDesc.of(DirectMethodHandleDesc.Kind.VIRTUAL, ClassDesc.ofDescriptor("LEffectivelyFinalTest;"), "foo", mt));
         check(mh.invoke(f).toString().equals("invoking EffectivelyFinalTest.foo()"));
     }
 
@@ -57,7 +54,7 @@
     void test5(EffectivelyFinalTest f) throws Throwable {
         ClassDesc c = ClassDesc.ofDescriptor("Ljava/lang/String;");;
         MethodTypeDesc mt = MethodTypeDesc.of(c);
-        MethodHandle mh = ldc(MethodHandleDesc.of(MethodHandleDesc.Kind.VIRTUAL, cField, "foo", mt));
+        MethodHandle mh = ldc(MethodHandleDesc.of(DirectMethodHandleDesc.Kind.VIRTUAL, cField, "foo", mt));
         check(mh.invoke(f).toString().equals("invoking EffectivelyFinalTest.foo()"));
     }
 }
--- a/test/langtools/tools/javac/specialConstantFolding/harness/tests/FindConstructorTest.java	Thu Jun 14 21:00:37 2018 -0700
+++ b/test/langtools/tools/javac/specialConstantFolding/harness/tests/FindConstructorTest.java	Fri Jun 15 11:14:31 2018 -0700
@@ -1,11 +1,7 @@
 /* /nodynamiccopyright/ */
 
 import java.lang.invoke.*;
-import java.lang.constant.ClassDesc;
-import java.lang.constant.ConstantDescs;
-import java.lang.constant.MethodHandleDesc;
-import java.lang.constant.MethodTypeDesc;
-
+import java.lang.constant.*;
 import static java.lang.invoke.Intrinsics.*;
 
 public class FindConstructorTest extends ConstantFoldingTest {
@@ -25,7 +21,7 @@
 
     @InstructionInfo(bytecodePosition=0, values={"CONSTANT_MethodHandle_info", "REF_newInvokeSpecial"})
     void test1() throws Throwable {
-        final MethodHandle mhNewFindConstructorTest = ldc(MethodHandleDesc.of(MethodHandleDesc.Kind.CONSTRUCTOR, ClassDesc.ofDescriptor("LFindConstructorTest;"), "<init>",
+        final MethodHandle mhNewFindConstructorTest = ldc(MethodHandleDesc.of(DirectMethodHandleDesc.Kind.CONSTRUCTOR, ClassDesc.ofDescriptor("LFindConstructorTest;"), "<init>",
                                                                               MethodTypeDesc.of(ConstantDescs.CR_void)));
         FindConstructorTest foo = (FindConstructorTest) mhNewFindConstructorTest.invokeExact();
         check(foo.toString().equals("invoking FindConstructorTest.toString()"));
@@ -33,7 +29,7 @@
 
     @InstructionInfo(bytecodePosition=0, values={"CONSTANT_MethodHandle_info", "REF_newInvokeSpecial"})
     void test2() throws Throwable {
-        MethodHandle mhNewFindConstructorTest = ldc(MethodHandleDesc.of(MethodHandleDesc.Kind.CONSTRUCTOR, ClassDesc.ofDescriptor("LFindConstructorTest;"), "<init>",
+        MethodHandle mhNewFindConstructorTest = ldc(MethodHandleDesc.of(DirectMethodHandleDesc.Kind.CONSTRUCTOR, ClassDesc.ofDescriptor("LFindConstructorTest;"), "<init>",
                                                                         MethodTypeDesc.of(ConstantDescs.CR_void)));
         FindConstructorTest foo = (FindConstructorTest) mhNewFindConstructorTest.invokeExact();
         check(foo.toString().equals("invoking FindConstructorTest.toString()"));
--- a/test/langtools/tools/javac/specialConstantFolding/harness/tests/FindGetterTest.java	Thu Jun 14 21:00:37 2018 -0700
+++ b/test/langtools/tools/javac/specialConstantFolding/harness/tests/FindGetterTest.java	Fri Jun 15 11:14:31 2018 -0700
@@ -1,11 +1,9 @@
 /* /nodynamiccopyright/ */
 
 import java.lang.invoke.*;
-import java.lang.constant.ClassDesc;
-import java.lang.constant.MethodHandleDesc;
-
+import java.lang.constant.*;
 import static java.lang.invoke.Intrinsics.*;
-import static java.lang.constant.MethodHandleDesc.Kind.GETTER;
+import static java.lang.constant.DirectMethodHandleDesc.Kind.GETTER;
 
 public class FindGetterTest extends ConstantFoldingTest {
     String strField = "instance field";
--- a/test/langtools/tools/javac/specialConstantFolding/harness/tests/FindMethodWithGenericArgumentsTest.java	Thu Jun 14 21:00:37 2018 -0700
+++ b/test/langtools/tools/javac/specialConstantFolding/harness/tests/FindMethodWithGenericArgumentsTest.java	Fri Jun 15 11:14:31 2018 -0700
@@ -1,10 +1,7 @@
 /* /nodynamiccopyright/ */
 
 import java.lang.invoke.*;
-import java.lang.constant.ClassDesc;
-import java.lang.constant.ConstantDescs;
-import java.lang.constant.MethodHandleDesc;
-import java.lang.constant.MethodTypeDesc;
+import java.lang.constant.*;
 import java.util.List;
 import static java.lang.invoke.Intrinsics.*;
 
@@ -14,7 +11,7 @@
 
     @InstructionInfo(bytecodePosition=0, values={"CONSTANT_MethodHandle_info", "REF_invokeVirtual"})
     void test() {
-        MethodHandle mh2 = ldc(MethodHandleDesc.of(MethodHandleDesc.Kind.VIRTUAL, ClassDesc.ofDescriptor("LFindMethodWithGenericArgumentsTest;"), "bar",
+        MethodHandle mh2 = ldc(MethodHandleDesc.of(DirectMethodHandleDesc.Kind.VIRTUAL, ClassDesc.ofDescriptor("LFindMethodWithGenericArgumentsTest;"), "bar",
                                                    MethodTypeDesc.of(ConstantDescs.CR_void, ConstantDescs.CR_List)));
     }
 }
--- a/test/langtools/tools/javac/specialConstantFolding/harness/tests/FindSetterTest.java	Thu Jun 14 21:00:37 2018 -0700
+++ b/test/langtools/tools/javac/specialConstantFolding/harness/tests/FindSetterTest.java	Fri Jun 15 11:14:31 2018 -0700
@@ -1,12 +1,9 @@
 /* /nodynamiccopyright/ */
 
 import java.lang.invoke.*;
-import java.lang.constant.ClassDesc;
-import java.lang.constant.ConstantDescs;
-import java.lang.constant.MethodHandleDesc;
-
+import java.lang.constant.*;
 import static java.lang.invoke.Intrinsics.*;
-import static java.lang.constant.MethodHandleDesc.Kind.SETTER;
+import static java.lang.constant.DirectMethodHandleDesc.Kind.SETTER;
 
 public class FindSetterTest extends ConstantFoldingTest {
     String strField = "instance field";
--- a/test/langtools/tools/javac/specialConstantFolding/harness/tests/FindStaticGetterTest.java	Thu Jun 14 21:00:37 2018 -0700
+++ b/test/langtools/tools/javac/specialConstantFolding/harness/tests/FindStaticGetterTest.java	Fri Jun 15 11:14:31 2018 -0700
@@ -1,12 +1,9 @@
 /* /nodynamiccopyright/ */
 
 import java.lang.invoke.*;
-import java.lang.constant.ClassDesc;
-import java.lang.constant.ConstantDescs;
-import java.lang.constant.MethodHandleDesc;
-
+import java.lang.constant.*;
 import static java.lang.invoke.Intrinsics.*;
-import static java.lang.constant.MethodHandleDesc.Kind.STATIC_GETTER;
+import static java.lang.constant.DirectMethodHandleDesc.Kind.STATIC_GETTER;
 
 public class FindStaticGetterTest extends ConstantFoldingTest {
     static String staticStrField = "class field";
--- a/test/langtools/tools/javac/specialConstantFolding/harness/tests/FindStaticSetterTest.java	Thu Jun 14 21:00:37 2018 -0700
+++ b/test/langtools/tools/javac/specialConstantFolding/harness/tests/FindStaticSetterTest.java	Fri Jun 15 11:14:31 2018 -0700
@@ -1,12 +1,9 @@
 /* /nodynamiccopyright/ */
 
 import java.lang.invoke.*;
-import java.lang.constant.ClassDesc;
-import java.lang.constant.ConstantDescs;
-import java.lang.constant.MethodHandleDesc;
-
+import java.lang.constant.*;
 import static java.lang.invoke.Intrinsics.*;
-import static java.lang.constant.MethodHandleDesc.Kind.STATIC_SETTER;
+import static java.lang.constant.DirectMethodHandleDesc.Kind.STATIC_SETTER;
 
 public class FindStaticSetterTest extends ConstantFoldingTest {
     static String staticStrField = "class field";
--- a/test/langtools/tools/javac/specialConstantFolding/harness/tests/FindStaticTest.java	Thu Jun 14 21:00:37 2018 -0700
+++ b/test/langtools/tools/javac/specialConstantFolding/harness/tests/FindStaticTest.java	Fri Jun 15 11:14:31 2018 -0700
@@ -1,9 +1,7 @@
 /* /nodynamiccopyright/ */
 
 import java.lang.invoke.*;
-import java.lang.constant.ClassDesc;
-import java.lang.constant.MethodHandleDesc;
-import java.lang.constant.MethodTypeDesc;
+import java.lang.constant.*;
 
 import static java.lang.invoke.Intrinsics.*;
 
@@ -25,20 +23,20 @@
     @InstructionInfo(bytecodePosition=0, values={"CONSTANT_MethodHandle_info", "REF_invokeStatic"})
     void test1() throws Throwable {
         final MethodTypeDesc mt = MethodTypeDesc.of(ClassDesc.ofDescriptor("Ljava/lang/String;"));
-        MethodHandle mh2 = ldc(MethodHandleDesc.of(MethodHandleDesc.Kind.STATIC, ClassDesc.ofDescriptor("LFindStaticTest;"), "foo", mt));
+        MethodHandle mh2 = ldc(MethodHandleDesc.of(DirectMethodHandleDesc.Kind.STATIC, ClassDesc.ofDescriptor("LFindStaticTest;"), "foo", mt));
         check(mh2.invoke().toString().equals("invoking static method FindStaticTest.foo()"));
     }
 
     @InstructionInfo(bytecodePosition=0, values={"CONSTANT_MethodHandle_info", "REF_invokeStatic"})
     void test2() throws Throwable {
         MethodTypeDesc mt = MethodTypeDesc.of(ClassDesc.ofDescriptor("Ljava/lang/String;"));
-        MethodHandle mh2 = ldc(MethodHandleDesc.of(MethodHandleDesc.Kind.STATIC, ClassDesc.ofDescriptor("LFindStaticTest;"), "foo", mt));
+        MethodHandle mh2 = ldc(MethodHandleDesc.of(DirectMethodHandleDesc.Kind.STATIC, ClassDesc.ofDescriptor("LFindStaticTest;"), "foo", mt));
         check(mh2.invoke().toString().equals("invoking static method FindStaticTest.foo()"));
     }
 
     @InstructionInfo(bytecodePosition=0, values={"CONSTANT_MethodHandle_info", "REF_invokeStatic"})
     void test3() throws Throwable {
-        MethodHandle mh2 = ldc(MethodHandleDesc.of(MethodHandleDesc.Kind.STATIC, ClassDesc.ofDescriptor("LFindStaticTest;"), "foo", MethodTypeDesc.of(ClassDesc.ofDescriptor("Ljava/lang/String;"))));
+        MethodHandle mh2 = ldc(MethodHandleDesc.of(DirectMethodHandleDesc.Kind.STATIC, ClassDesc.ofDescriptor("LFindStaticTest;"), "foo", MethodTypeDesc.of(ClassDesc.ofDescriptor("Ljava/lang/String;"))));
         check(mh2.invoke().toString().equals("invoking static method FindStaticTest.foo()"));
     }
 }
--- a/test/langtools/tools/javac/specialConstantFolding/harness/tests/FindVirtualTest01.java	Thu Jun 14 21:00:37 2018 -0700
+++ b/test/langtools/tools/javac/specialConstantFolding/harness/tests/FindVirtualTest01.java	Fri Jun 15 11:14:31 2018 -0700
@@ -1,11 +1,7 @@
 /* /nodynamiccopyright/ */
 
 import java.lang.invoke.*;
-import java.lang.constant.ClassDesc;
-import java.lang.constant.ConstantDescs;
-import java.lang.constant.MethodHandleDesc;
-import java.lang.constant.MethodTypeDesc;
-
+import java.lang.constant.*;
 import static java.lang.invoke.Intrinsics.*;
 
 /** Tests the use of MethodType.MethodTypeRef.of(Class<?> rtype) in combination with
@@ -35,7 +31,7 @@
     @InstructionInfo(bytecodePosition=0, values={"CONSTANT_MethodHandle_info", "REF_invokeVirtual"})
     void test1(FindVirtualTest01 f) throws Throwable {
         final MethodTypeDesc mt = MethodTypeDesc.of(ClassDesc.ofDescriptor("Ljava/lang/String;"));
-        MethodHandle mh2 = ldc(MethodHandleDesc.of(MethodHandleDesc.Kind.VIRTUAL, ClassDesc.ofDescriptor("LFindVirtualTest01;"), "foo", mt));
+        MethodHandle mh2 = ldc(MethodHandleDesc.of(DirectMethodHandleDesc.Kind.VIRTUAL, ClassDesc.ofDescriptor("LFindVirtualTest01;"), "foo", mt));
         check(mh2.invoke(f).toString().equals("invoking method FindVirtualTest01.foo()"));
     }
 
@@ -43,7 +39,7 @@
     void test2(FindVirtualTest01 f) throws Throwable {
         final MethodTypeDesc mt = MethodTypeDesc.of(ClassDesc.ofDescriptor("Ljava/lang/String;"));
         final ClassDesc fooClass = ClassDesc.ofDescriptor("LFindVirtualTest01;");
-        MethodHandle mh2 = ldc(MethodHandleDesc.of(MethodHandleDesc.Kind.VIRTUAL, fooClass, "foo", mt));
+        MethodHandle mh2 = ldc(MethodHandleDesc.of(DirectMethodHandleDesc.Kind.VIRTUAL, fooClass, "foo", mt));
         check(mh2.invoke(f).toString().equals("invoking method FindVirtualTest01.foo()"));
     }
 
@@ -51,27 +47,27 @@
     void test2_1(FindVirtualTest01 f) throws Throwable {
         final MethodTypeDesc mt = MethodTypeDesc.of(ClassDesc.ofDescriptor("Ljava/lang/String;"));
         final ClassDesc fooClass = ClassDesc.ofDescriptor("LFindVirtualTest01;");
-        MethodHandle mh2 = ldc(MethodHandleDesc.of(MethodHandleDesc.Kind.VIRTUAL, fooClass, "foo", mt));
+        MethodHandle mh2 = ldc(MethodHandleDesc.of(DirectMethodHandleDesc.Kind.VIRTUAL, fooClass, "foo", mt));
         check(mh2.invoke(f).toString().equals("invoking method FindVirtualTest01.foo()"));
     }
 
     @InstructionInfo(bytecodePosition=0, values={"CONSTANT_MethodHandle_info", "REF_invokeVirtual"})
     void test3(FindVirtualTest01 f) throws Throwable {
         MethodTypeDesc mt = MethodTypeDesc.of(ClassDesc.ofDescriptor("Ljava/lang/String;"));
-        MethodHandle mh2 = ldc(MethodHandleDesc.of(MethodHandleDesc.Kind.VIRTUAL, ClassDesc.ofDescriptor("LFindVirtualTest01;"), "foo", mt));
+        MethodHandle mh2 = ldc(MethodHandleDesc.of(DirectMethodHandleDesc.Kind.VIRTUAL, ClassDesc.ofDescriptor("LFindVirtualTest01;"), "foo", mt));
         check(mh2.invoke(f).toString().equals("invoking method FindVirtualTest01.foo()"));
     }
 
     @InstructionInfo(bytecodePosition=0, values={"CONSTANT_MethodHandle_info", "REF_invokeVirtual"})
     void test4(FindVirtualTest01 f) throws Throwable {
-        MethodHandle mh2 = ldc(MethodHandleDesc.of(MethodHandleDesc.Kind.VIRTUAL, ClassDesc.ofDescriptor("LFindVirtualTest01;"), "foo",
+        MethodHandle mh2 = ldc(MethodHandleDesc.of(DirectMethodHandleDesc.Kind.VIRTUAL, ClassDesc.ofDescriptor("LFindVirtualTest01;"), "foo",
                                                    MethodTypeDesc.of(ClassDesc.ofDescriptor("Ljava/lang/String;"))));
         check(mh2.invoke(f).toString().equals("invoking method FindVirtualTest01.foo()"));
     }
 
     @InstructionInfo(bytecodePosition=0, values={"CONSTANT_MethodHandle_info", "REF_invokeVirtual"})
     void test5(FindVirtualTest01 f) throws Throwable {
-        MethodHandle mhBar = ldc(MethodHandleDesc.of(MethodHandleDesc.Kind.VIRTUAL, ClassDesc.ofDescriptor("LFindVirtualTest01;"), "bar",
+        MethodHandle mhBar = ldc(MethodHandleDesc.of(DirectMethodHandleDesc.Kind.VIRTUAL, ClassDesc.ofDescriptor("LFindVirtualTest01;"), "bar",
                                                      MethodTypeDesc.of(ClassDesc.ofDescriptor("Ljava/lang/String;"), ConstantDescs.CR_int)));
         check(mhBar.invoke(f, 3).toString().equals("invoking method FindVirtualTest01.bar() with argument 3"));
     }
--- a/test/langtools/tools/javac/specialConstantFolding/harness/tests/FindVirtualTest02.java	Thu Jun 14 21:00:37 2018 -0700
+++ b/test/langtools/tools/javac/specialConstantFolding/harness/tests/FindVirtualTest02.java	Fri Jun 15 11:14:31 2018 -0700
@@ -1,10 +1,7 @@
 /* /nodynamiccopyright/ */
 
 import java.lang.invoke.*;
-import java.lang.constant.ClassDesc;
-import java.lang.constant.MethodHandleDesc;
-import java.lang.constant.MethodTypeDesc;
-
+import java.lang.constant.*;
 import static java.lang.invoke.Intrinsics.*;
 
 public class FindVirtualTest02 extends ConstantFoldingTest {
@@ -26,7 +23,7 @@
     @InstructionInfo(bytecodePosition=0, values={"CONSTANT_MethodHandle_info", "REF_invokeVirtual"})
     void test1(Foo f) throws Throwable {
         final MethodTypeDesc mt = MethodTypeDesc.ofDescriptor("()Ljava/lang/String;");
-        MethodHandle mh2 = ldc(MethodHandleDesc.of(MethodHandleDesc.Kind.VIRTUAL, ClassDesc.ofDescriptor("LFindVirtualTest02$Foo;"), "foo", mt));
+        MethodHandle mh2 = ldc(MethodHandleDesc.of(DirectMethodHandleDesc.Kind.VIRTUAL, ClassDesc.ofDescriptor("LFindVirtualTest02$Foo;"), "foo", mt));
         check(mh2.invoke(f).toString().equals("invoking method Foo.foo()"));
     }
 }
--- a/test/langtools/tools/javac/specialConstantFolding/harness/tests/InstanceTrackableMethodsTest.java	Thu Jun 14 21:00:37 2018 -0700
+++ b/test/langtools/tools/javac/specialConstantFolding/harness/tests/InstanceTrackableMethodsTest.java	Fri Jun 15 11:14:31 2018 -0700
@@ -1,6 +1,6 @@
 /* /nodynamiccopyright/ */
 
-import java.lang.constant.ClassDesc;
+import java.lang.constant.*;
 
 import static java.lang.invoke.Intrinsics.*;
 
--- a/test/langtools/tools/javac/specialConstantFolding/harness/tests/StringFoldingTest.java	Thu Jun 14 21:00:37 2018 -0700
+++ b/test/langtools/tools/javac/specialConstantFolding/harness/tests/StringFoldingTest.java	Fri Jun 15 11:14:31 2018 -0700
@@ -1,7 +1,6 @@
 /* /nodynamiccopyright/ */
 
-import java.lang.constant.ClassDesc;
-
+import java.lang.constant.*;
 import static java.lang.invoke.Intrinsics.*;
 
 public class StringFoldingTest extends ConstantFoldingTest {