Fix issue with obsolete methods and const-method-handle
We were incorrectly using the non-obsolete version of the method to
search for the target of const-method-handle instructions. This meant
that obsolete methods would see the wrong method-handle or crash.
Since no java code (currently) compiles to dex code using
'const-method-handle' we needed to use ASM to construct the test
class.
Bug: 73744024
Test: ./test.py --host -j50
Change-Id: I14480170e12eee7f2df5ac084254039a040848c3
diff --git a/test/1948-obsolete-const-method-handle/build b/test/1948-obsolete-const-method-handle/build
new file mode 100644
index 0000000..ac0dcd9
--- /dev/null
+++ b/test/1948-obsolete-const-method-handle/build
@@ -0,0 +1,25 @@
+#!/bin/bash
+#
+# Copyright 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Make us exit on a failure
+set -e
+
+mkdir classes
+./util-src/build-classes $PWD/classes
+
+${DX} --dex --min-sdk-version=28 --output=classes.dex classes
+
+zip $TEST_NAME.jar classes.dex