Fix 957-methodhandle-transforms test
The test hardcoded one point of divergence. This is now fixed in the
transform implementation for MethodHandles.exactInvoker(). This allows
us to remove 957-methodhandle-transforms from the RI known failures list.
Bug: 73888836
Bug: 207462751
Test: art/test.py --host -r
Test: art/tools/run-libcore-tests.sh --host
Change-Id: I06ca7b3d875833a6f1c073e570eb0e21c4b15eca
diff --git a/test/957-methodhandle-transforms/src/Main.java b/test/957-methodhandle-transforms/src/Main.java
index 9803438..2b16485 100644
--- a/test/957-methodhandle-transforms/src/Main.java
+++ b/test/957-methodhandle-transforms/src/Main.java
@@ -950,12 +950,20 @@
MethodHandle exactInvoker = MethodHandles.exactInvoker(target.type());
assertEquals("barbar", (String) exactInvoker.invoke(target, "bar", "bar"));
+ assertEquals("barbar", (String) exactInvoker.invoke(target, (Object) returnBar(), "bar"));
try {
- String foo = (String) exactInvoker.invoke(target, (Object) returnBar(), "bar");
+ assertEquals("barbar", (String) invoker.invoke(target, (Object) Integer.valueOf(7), "bar"));
fail();
- } catch (WrongMethodTypeException expected) {
+ } catch (ClassCastException expected) {
}
try {
+ assertEquals("barbar", (String) invoker.invoke(target, (Object) null, "bar"));
+ fail();
+ } catch (NullPointerException expected) {
+ }
+ exactInvoker.invoke(target, (Object) returnBar(), "bar");
+
+ try {
String foo = (String) exactInvoker.invoke(target, "bar", "bar", 24);
fail();
} catch (WrongMethodTypeException expected) {
diff --git a/test/knownfailures.json b/test/knownfailures.json
index ce4ada4..f68f6f0 100644
--- a/test/knownfailures.json
+++ b/test/knownfailures.json
@@ -1058,7 +1058,6 @@
"954-invoke-polymorphic-verifier",
"955-methodhandles-smali",
"956-methodhandles",
- "957-methodhandle-transforms",
"958-methodhandle-stackframe",
"972-default-imt-collision",
"972-iface-super-multidex",