summaryrefslogtreecommitdiff
path: root/tests/003-omnibus-opcodes/src/UnresTest2.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/003-omnibus-opcodes/src/UnresTest2.java')
-rw-r--r--tests/003-omnibus-opcodes/src/UnresTest2.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/003-omnibus-opcodes/src/UnresTest2.java b/tests/003-omnibus-opcodes/src/UnresTest2.java
new file mode 100644
index 0000000..768be8f
--- /dev/null
+++ b/tests/003-omnibus-opcodes/src/UnresTest2.java
@@ -0,0 +1,49 @@
+/*
+ * Test failure to resolve classes.
+ */
+class UnresTest2 {
+ /*
+ * Try check-cast and instance-of.
+ */
+ static boolean checkCasts(Object obj) {
+ boolean foo = false;
+
+ try {
+ UnresClass un = (UnresClass) obj;
+ assert(false);
+ } catch (NoClassDefFoundError ncdfe) {
+ // good
+ }
+ try {
+ foo = obj instanceof UnresClass;
+ assert(false);
+ } catch (NoClassDefFoundError ncdfe) {
+ // good
+ }
+
+ return foo;
+ }
+
+ public static void run() {
+ System.out.println("UnresTest2...");
+ UnresClass un;
+ UnresStuff stuff = new UnresStuff();
+
+ try {
+ un = new UnresClass();
+ assert(false);
+ } catch (NoClassDefFoundError ncdfe) {
+ // good
+ }
+
+ try {
+ UnresClass[] uar = new UnresClass[3];
+ assert(false);
+ } catch (NoClassDefFoundError ncdfe) {
+ // good
+ }
+
+ checkCasts(stuff);
+ System.out.println("UnresTest2 done");
+ }
+}