Align method handle type with the runtime

- Remove temporary hack in invoke-custom test due to runtime bug
since an updated runtime fix it.

Change-Id: I5424bacf7ca0e292974df7e81b35dea51d8a9b51
diff --git a/src/test/examplesAndroidO/invokecustom/InvokeCustom.java b/src/test/examplesAndroidO/invokecustom/InvokeCustom.java
index 0d4d5c5..449d426 100644
--- a/src/test/examplesAndroidO/invokecustom/InvokeCustom.java
+++ b/src/test/examplesAndroidO/invokecustom/InvokeCustom.java
@@ -102,74 +102,15 @@
     System.out.println("targetMethodTest4");
   }
 
-  public static CallSite bsmCreateCallSite(
-      MethodHandles.Lookup caller, String name, MethodType type, MethodHandle mh)
-      throws Throwable {
-    // Using mh to create the call site fails when run on Art. See b/36957105 for details.
-    final MethodHandle targetMH = MethodHandles.lookup().findSpecial(Super.class,
-                "targetMethodTest5", MethodType.methodType(void.class), InvokeCustom.class);
-    return new ConstantCallSite(targetMH);
-  }
-
-  public static CallSite bsmCreateCallCallingtargetMethodTest6(
-      MethodHandles.Lookup caller, String name, MethodType type, MethodHandle mh)
-      throws Throwable {
-    // Using mh to create the call site fails when run on Art. See b/36957105 for details.
-    final MethodHandle targetMH =
-        MethodHandles.lookup().findVirtual(
-            I.class, "targetMethodTest6", MethodType.methodType(void.class));
-    return new ConstantCallSite(targetMH);
-  }
-
-  public static CallSite bsmCreateCallCallingtargetMethodTest7(
-      MethodHandles.Lookup caller, String name, MethodType type, MethodHandle mh)
-      throws Throwable {
-    // Using mh to create the call site fails when run on Art. See b/36957105 for details.
-    final MethodHandle targetMH =
-        MethodHandles.lookup().findVirtual(
-            J.class, "targetMethodTest7", MethodType.methodType(void.class));
-    return new ConstantCallSite(targetMH);
-  }
-
   public void targetMethodTest8() {
     System.out.println("targetMethodTest8 from InvokeCustom");
   }
 
-  public static CallSite bsmCreateCallCallingtargetMethodTest8(
-      MethodHandles.Lookup caller, String name, MethodType type, MethodHandle mh)
-      throws Throwable {
-    // Using mh to create the call site fails when run on Art. See b/36957105 for details.
-    final MethodHandle targetMH =
-        MethodHandles.lookup().findVirtual(
-            J.class, "targetMethodTest8", MethodType.methodType(void.class));
-    return new ConstantCallSite(targetMH);
-  }
-
-  public static CallSite bsmCreateCallCallingtargetMethodTest9(
-      MethodHandles.Lookup caller, String name, MethodType type, MethodHandle mh)
-      throws Throwable {
-    // Using mh to create the call site fails when run on Art. See b/36957105 for details.
-    final MethodHandle targetMH =
-        MethodHandles.lookup().findVirtual(
-            InvokeCustom.class, "targetMethodTest9", MethodType.methodType(void.class));
-    return new ConstantCallSite(targetMH);
-  }
-
   public void targetMethodTest10() {
     System.out.println("targetMethodTest10 from InvokeCustom");
   }
 
-  public static CallSite bsmCreateCallCallingtargetMethodTest10(
-      MethodHandles.Lookup caller, String name, MethodType type, MethodHandle mh)
-      throws Throwable {
-    // Using mh to create the call site fails when run on Art. See b/36957105 for details.
-    final MethodHandle targetMH =
-        MethodHandles.lookup().findVirtual(
-            InvokeCustom.class, "targetMethodTest10", MethodType.methodType(void.class));
-    return new ConstantCallSite(targetMH);
-  }
-
-  public static CallSite bsmCreateCallCallingtargetMethod(
+  public static CallSite bsmCreateCallSite(
       MethodHandles.Lookup caller, String name, MethodType type, MethodHandle mh)
       throws Throwable {
     return new ConstantCallSite(mh);
diff --git a/src/test/examplesAndroidO/invokecustom/TestGenerator.java b/src/test/examplesAndroidO/invokecustom/TestGenerator.java
index 883106f..5c550e9 100644
--- a/src/test/examplesAndroidO/invokecustom/TestGenerator.java
+++ b/src/test/examplesAndroidO/invokecustom/TestGenerator.java
@@ -189,7 +189,7 @@
     MethodType mt = MethodType.methodType(CallSite.class, MethodHandles.Lookup.class, String.class,
         MethodType.class, MethodHandle.class);
     Handle bootstrap = new Handle(Opcodes.H_INVOKESTATIC, Type.getInternalName(InvokeCustom.class),
-        "bsmCreateCallCallingtargetMethodTest6", mt.toMethodDescriptorString(), false);
+        "bsmCreateCallSite", mt.toMethodDescriptorString(), false);
     mv.visitTypeInsn(Opcodes.NEW, Type.getInternalName(InvokeCustom.class));
     mv.visitInsn(Opcodes.DUP);
     mv.visitMethodInsn(
@@ -212,7 +212,7 @@
     MethodType mt = MethodType.methodType(CallSite.class, MethodHandles.Lookup.class, String.class,
         MethodType.class, MethodHandle.class);
     Handle bootstrap = new Handle(Opcodes.H_INVOKESTATIC, Type.getInternalName(InvokeCustom.class),
-        "bsmCreateCallCallingtargetMethodTest7", mt.toMethodDescriptorString(), false);
+        "bsmCreateCallSite", mt.toMethodDescriptorString(), false);
     mv.visitTypeInsn(Opcodes.NEW, Type.getInternalName(InvokeCustom.class));
     mv.visitInsn(Opcodes.DUP);
     mv.visitMethodInsn(
@@ -235,7 +235,7 @@
     MethodType mt = MethodType.methodType(CallSite.class, MethodHandles.Lookup.class, String.class,
         MethodType.class, MethodHandle.class);
     Handle bootstrap = new Handle(Opcodes.H_INVOKESTATIC, Type.getInternalName(InvokeCustom.class),
-        "bsmCreateCallCallingtargetMethodTest8", mt.toMethodDescriptorString(), false);
+        "bsmCreateCallSite", mt.toMethodDescriptorString(), false);
     mv.visitTypeInsn(Opcodes.NEW, Type.getInternalName(InvokeCustom.class));
     mv.visitInsn(Opcodes.DUP);
     mv.visitMethodInsn(
@@ -258,7 +258,7 @@
     MethodType mt = MethodType.methodType(CallSite.class, MethodHandles.Lookup.class, String.class,
         MethodType.class, MethodHandle.class);
     Handle bootstrap = new Handle(Opcodes.H_INVOKESTATIC, Type.getInternalName(InvokeCustom.class),
-        "bsmCreateCallCallingtargetMethodTest9", mt.toMethodDescriptorString(), false);
+        "bsmCreateCallSite", mt.toMethodDescriptorString(), false);
     mv.visitTypeInsn(Opcodes.NEW, Type.getInternalName(InvokeCustom.class));
     mv.visitInsn(Opcodes.DUP);
     mv.visitMethodInsn(
@@ -281,7 +281,7 @@
     MethodType mt = MethodType.methodType(CallSite.class, MethodHandles.Lookup.class, String.class,
         MethodType.class, MethodHandle.class);
     Handle bootstrap = new Handle(Opcodes.H_INVOKESTATIC, Type.getInternalName(InvokeCustom.class),
-        "bsmCreateCallCallingtargetMethodTest10", mt.toMethodDescriptorString(), false);
+        "bsmCreateCallSite", mt.toMethodDescriptorString(), false);
     mv.visitTypeInsn(Opcodes.NEW, Type.getInternalName(InvokeCustom.class));
     mv.visitInsn(Opcodes.DUP);
     mv.visitMethodInsn(
@@ -303,7 +303,7 @@
     MethodType mt = MethodType.methodType(CallSite.class, MethodHandles.Lookup.class, String.class,
         MethodType.class, MethodHandle.class);
     Handle bootstrap = new Handle(Opcodes.H_INVOKESTATIC, Type.getInternalName(InvokeCustom.class),
-        "bsmCreateCallCallingtargetMethod", mt.toMethodDescriptorString(), false);
+        "bsmCreateCallSite", mt.toMethodDescriptorString(), false);
     mv.visitFieldInsn(Opcodes.GETSTATIC,
         "java/lang/System",
         "out",
@@ -330,7 +330,7 @@
     MethodType mt = MethodType.methodType(CallSite.class, MethodHandles.Lookup.class, String.class,
             MethodType.class, MethodHandle.class);
     Handle bootstrap = new Handle(Opcodes.H_INVOKESTATIC, Type.getInternalName(InvokeCustom.class),
-        "bsmCreateCallCallingtargetMethod", mt.toMethodDescriptorString(), false);
+        "bsmCreateCallSite", mt.toMethodDescriptorString(), false);
     mv.visitLdcInsn("Write static field");
     mv.visitInvokeDynamicInsn("staticField1", "(Ljava/lang/String;)V", bootstrap,
         new Handle(Opcodes.H_PUTSTATIC, Type.getInternalName(InvokeCustom.class),
@@ -361,7 +361,7 @@
     MethodType mt = MethodType.methodType(CallSite.class, MethodHandles.Lookup.class, String.class,
         MethodType.class, MethodHandle.class);
     Handle bootstrap = new Handle(Opcodes.H_INVOKESTATIC, Type.getInternalName(InvokeCustom.class),
-        "bsmCreateCallCallingtargetMethod", mt.toMethodDescriptorString(), false);
+        "bsmCreateCallSite", mt.toMethodDescriptorString(), false);
     mv.visitFieldInsn(Opcodes.GETSTATIC,
         "java/lang/System",
         "out",
@@ -392,7 +392,7 @@
     MethodType mt = MethodType.methodType(CallSite.class, MethodHandles.Lookup.class, String.class,
         MethodType.class, MethodHandle.class);
     Handle bootstrap = new Handle(Opcodes.H_INVOKESTATIC, Type.getInternalName(InvokeCustom.class),
-        "bsmCreateCallCallingtargetMethod", mt.toMethodDescriptorString(), false);
+        "bsmCreateCallSite", mt.toMethodDescriptorString(), false);
     mv.visitTypeInsn(Opcodes.NEW, Type.getInternalName(InvokeCustom.class));
     mv.visitInsn(Opcodes.DUP);
     mv.visitMethodInsn(