Preserve JNI bindings across structural redefinition
We were incorrectly clearing the JNI bindings of native methods on
classes which are structurally redefined. This can cause major issues
with code which uses JNIEnv::RegisterNatives to setup native methods.
This change copies the required information from the old to the new
method. Since the RegisterNatives method can be run asynchronously we
need to wait until we gain the final SuspendAll to actually read and
copy the registration.
Test: ./test.py --host
Bug: 158476592
Change-Id: Ie8a33234bb852a46e5275502c842553637c8a2c6
diff --git a/test/2035-structural-native-method/src-art/Main.java b/test/2035-structural-native-method/src-art/Main.java
new file mode 100644
index 0000000..4bcd725
--- /dev/null
+++ b/test/2035-structural-native-method/src-art/Main.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+public class Main {
+ public static void main(String[] args) throws Exception {
+ art.Test2035.run();
+ }
+}