summaryrefslogtreecommitdiff
path: root/test/831-unverified-bcp/src/Main.java
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2022-01-16 14:01:36 -0800
committerLinux Build Service Account <lnxbuild@localhost>2022-01-16 14:01:36 -0800
commit5806f26e603150889d7b7e044cd8fb685c832f4e (patch)
treee60b0a64a2b342e96f6b886ec3e2e453e494e567 /test/831-unverified-bcp/src/Main.java
parentaa20688e701376b1a4cfffc6284721819806cb90 (diff)
parentf9da627a42193f596d33d799bf323fced18214c5 (diff)
Merge f9da627a42193f596d33d799bf323fced18214c5 on remote branch
Change-Id: Iaf48868208da271af8b4536f089c44bf4412cc9e
Diffstat (limited to 'test/831-unverified-bcp/src/Main.java')
-rw-r--r--test/831-unverified-bcp/src/Main.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/831-unverified-bcp/src/Main.java b/test/831-unverified-bcp/src/Main.java
new file mode 100644
index 0000000000..853d8ed8d2
--- /dev/null
+++ b/test/831-unverified-bcp/src/Main.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+import dalvik.system.PathClassLoader;
+import java.io.File;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.nio.file.Files;
+import java.util.Arrays;
+
+public class Main {
+
+ public static void main(String[] args) throws Exception {
+ System.loadLibrary(args[0]);
+ appendToBootClassLoader(OTHER_DEX, /* isCorePlatform */ false);
+
+ try {
+ Class.forName("NonVerifiedClass");
+ throw new Error("Expected VerifyError");
+ } catch (VerifyError e) {
+ // Expected.
+ }
+ }
+
+ private static native int appendToBootClassLoader(String dexPath, boolean isCorePlatform);
+
+ private static final String OTHER_DEX =
+ new File(System.getenv("DEX_LOCATION"), "831-unverified-bcp-ex.jar").getAbsolutePath();
+}
+
+// Define the class also in the classpath, to trigger the AssertNoPendingException crash.
+class NonVerifiedClass {
+}